HTML - Multiple Forms Ie
I have a loop that extracts data out of the database and outputs a dropdown form with each line with options for the user. I have included an onChange = "this.form.submit();" for each dropdown. This works fine in Firefox, but does not work so well in Internet Explorer(yes, scripting is enabled). Here's the code:
<form method="post" action="some.php"> <input type = "hidden" name ="variable1" value ="'.$variable1.'"' /> <input type = "hidden" name ="variable2" value ="'.$variable2.'"' /> <select name = "'.$variable1.$variable2" onChange = "this.form.submit();"> <option value = "option_1"> Option 1</option> <option value = "option_2"> Option 2</option> <option value = "option_3"> Option 3</option> <option value = "option_4"> Option 4</option> </form> This code is then just echo'd for each line. $variable 1 and $variable2 are unique, so to name each form differently I just give combine the two for a unique name I can call at some.php. Symptoms: In Mozilla this works great. With IE(both 6 and 7) the variable1 and variable 2 are passed along, however option_1(the 1st default option displayed) is always passed along except for the last one of my list. The last one of the list always passes along the correct the correct value. So if I had two outputs A and B,and I selected Option2 for each of them...then A would send Option1 but B would send the selected Option2. Similar TutorialsHey guys and thanks in advanced for helpin' me out with this one. Anyways, I'm building a sort of "Advanced" search functionality. I want to give the user the ability to select multiple checkboxes in different categories (forms) but to be able to account for each checkbox even though they are in different forms. For example a Newspaper might have a search for an article by: Code: <FORM>(form name = "formONE") Paper Type Weekly [] Daily [x] Monthly [] {SUBMIT BUTTON} </ FORM> <FORM> (form name = "formTWO") Location Upper East [] Null County [] Down South [x] {SUBMIT BUTTON} </ FORM> <FORM> (form name = "formTHREE") Article Section Lifestyle [] Sports [x] Weather [] Finances [] {SUBMIT BUTTON} </ FORM> SO looking at the above...If the user "checked" (I placed 'x' in there) those boxes...and clicked ANY of the submit buttons, I want to be able to pull-in EACH of the checked items from ALL THREE of the forms. What is happening now with my code, is I'm only getting the results for the form which I clicked the 'submit' button in. I know you might ask, "why not just put them in one form?"... but I have them in separate forms because I want the user to have the ability to "CHECK/UNCHECK ALL" for each category (i.e. Paper Type, Location, Article Section...) Is it as easy as just wrapping all of those forms in one GIANT form, and supply each submit button with the name of that GIANT form? I hope this makes sense, and let me know if you need anything else at all...it's the last piece of this search and I just want to get it out of the waY!! Thanks guys! For years I have done things the same old way and they have worked fine, now I want to move a site over to xhtml from html4 and I am having problems get some code validated via W3C validator. Here is a sample of the code. It has 3 forms on the page. Each form is for a particular product in the shopping cart. ie, each form is for a unique product and it comprises a hidden text field containing the product_code (eg AAA3) and a submit button. When the chosen form is submitted I just pick up the POSTed data from the product_code variable ($_POST['product_code']) in php. This works fine for last few years but under the w3C validator it complains that the id is not unique for the product_code Quote: ID "product_code" already defined How can I get round this without having individual "product_code" ID's eg (id="product_code1" id="product_code2") as this would make life very complicated trying to workout what product_code was submitted. HTML Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> Here is Product - 1 <form id="form1" method="post" action=""> <p> <input type="hidden" id="product_code" value="AAA1" /> </p> <p> <label> <input type="submit" id="submit" value="Submit" /> </label> </p> </form> Here is Product - 2 <form id="form2" method="post" action=""> <p> <input type="hidden" id="product_code" value="AAA2" /> </p> <p> <label> <input type="submit" id="submit" value="Submit" /> </label> </p> </form> Here is Product - 3 <form id="form3" method="post" action=""> <p> <input type="hidden" id="product_code" value="AAA3" /> </p> <p> <label> <input type="submit" id="submit" value="Submit" /> </label> </p> </form> </body> </html> Hey Guys, I am having an issue where the only logical way I can see this being done, is with nested forms, which I know aren't allowed, and are breaking my design in IE. Here's the concept: I have a gallery of images that a user is managing (like 12 images are displayed on each page). Each image has a checkbox associated with it that the user can check and then at the bottom of the page the user can move all checked images to another folder. Therefore, all images and their checkbox's, along with the "move to folder" selection menu and submit button at the bottom are contained into one big form. Now within this form I have the option for users to move individual images. Each image has a select menu of folders and submit button that they can use to move a individual image. This therefore requires another form, just for this select menu (since I only want the action to be applied to this specific image and it's select input, and all others also have the same select input name, etc) and a submit button. See this screenshot for example: http://imagenerd.com/show.php?_img=gallery69SR.jpg Here is a snippet of code I am using in this example: Code: <form action="" method="post"> <div class="box-row last-row"> <div class="box-full"> <div class="box-top"><div class="box-bot"><div class="box-left"><div class="box-right"><div class="box-top-left"><div class="box-top-right"><div class="box-bot-left"><div class="box-bot-right"> <div class="box-content"> <h1>Folder: dafasd</h1> <div class="box-content-pad"> <div class="gallery-block"> <span class="edit-title" id="_199" title="edit title"><i>click to add title</i></span> <div class="image-option-links"> <a href="javascript:void(0);" onclick="share_codes_popup('/view-codes/?filename=siege_of_stormwynd-AXAP0.jpg&thumbname=th_siege_of_stormwynd-AXAP0.jpg', 'title');" title="get share codes">share</a> | <a href="javascript:void(0);" title="move this image" class="move_image">move</a> | <a href="/my-gallery/?delete_image=199" title="delete this image" onclick="return confirm('Are you sure you want to delete this image, siege_of_stormwynd-AXAP0.jpg?')">delete</a> </div> <div class="move-image-options"> <form action="" method="post"> <select name="move_image_folder"> <option value="1">Root</option> <option value="12">dafasd</option> <option value="13">dafasd</option> <option value="14">dafasd</option> <option value="15">asdfasdf</option> <option value="16">asdfasdf</option> </select> <input type="hidden" name="move_image_id" value="199" /> <input type="submit" name="move_image" value="Go" onclick="return confirm('Are you sure you want move this image, siege_of_stormwynd-AXAP0.jpg?');" /> </form> </div> <div class="image-box"> <a href="http://www.new.imagenerd.com/show.php?_img=siege_of_stormwynd-AXAP0.jpg" title="View siege_of_stormwynd-AXAP0.jpg" target="_blank"><img src="/thumbnails/th_siege_of_stormwynd-AXAP0.jpg" alt="siege_of_stormwynd-AXAP0.jpg" width="175" height="35" /></a> </div> <div> <table width="100%" cellpadding="0" cellspacing="0" class="image-select"> <tr> <td width="20" align="left"> <input type="checkbox" name="image_cb[]" value="199" class="checkbox" id="img_199" title="select siege_of_stormwynd-AXAP0.jpg" /> </td> <td align="left"><label for="img_199" title="select siege_of_stormwynd-AXAP0.jpg">siege_of_stormwynd-AXAP0.jpg</label></td> </tr> </table> <table width="100%" cellspacing="0" cellpadding="0" class="table-pad-2 table-align-td-left quick-select"> <tr> <td width="70"><b>Email/IM:</b></td> <td><input type="text" value="http://www.new.imagenerd.com/show.php?_img=siege_of_stormwynd-AXAP0.jpg" onclick="this.select()" /></td> </tr> <tr> <td><b>Forums:</b></td> <td><input type="text" value="" onclick="this.select()" /></td> </tr> <tr> <td><b>HTML:</b></td> <td><input type="text" value="<a href="http://www.new.imagenerd.com/show.ph...XAP0.jpg" target="_blank"><img src="http://www.new.imagenerd.com/thumbna...XAP0.jpg" alt="" border="0" width="175" height="35" /></a>" onclick="this.select()" /></td> </tr> <tr> <td colspan="2"><a href="/view-codes/?filename=siege_of_stormwynd-AXAP0.jpg&thumbname=th_siege_of_stormwynd-AXAP0.jpg" title="more share codes">more...</a></td> </tr> </table> </div> </div> . . (cut off other 2 gallery block divs due to forum character post restrictions) . <div class="clear"></div> </div> <div class="pager"> </div> </div> </div></div></div></div></div></div></div></div> </div> <div class="clear"></div> </div> <div class="box-row" style="margin: 12px 0px 0px 0px;"> <div class="box-full"> <div class="box-top"><div class="box-bot"><div class="box-left"><div class="box-right"><div class="box-top-left"><div class="box-top-right"><div class="box-bot-left"><div class="box-bot-right"> <div class="box-content align-center"> <p><b>With Selected Images:</b></p> <table cellpadding="0" cellspacing="0" align="center"> <tr> <td> <input type="checkbox" id="selectall" /> </td> <td width="120" align="left"> <label for="selectall">select/unselect all</label> </td> <td width="120"> <select name="action" id="action_select"> <option value="">----------</option> <option value="delete">Delete</option> <option value="move">Move to</option> </select> </td> <td width="120"> <select name="multi_folder" disabled="disabled" id="folder_select"> <option value="1">Root</option> <option value="12">dafasd</option> <option value="13">dafasd</option> <option value="14">dafasd</option> <option value="15">asdfasdf</option> <option value="16">asdfasdf</option> </select> </td> <td width="120"> <input type="submit" name="multi_action" value="Go" id="multi_go" disabled="disabled" onclick="return confirm('Are you sure you want to perform the selected action on all of the selected images?')" /> </td> </tr> </table> </div> </div></div></div></div></div></div></div></div> </div> <div class="clear"></div> </div> </form> Red - Associates with multi image options Blue - Associates with single image move option Any suggestions on how I can achieve this? Thanks, Kyle I am using the following code to submit two forms at the same time - Code: <body onLoad="document.forms[0].submit();document.forms[1].submit();"> <form action="form1.php" method="post" target="_self"> <input type="hidden" name="value1" value="value1"> </form> <form action="form2.php" method="post" target="_blank"> <input type="hidden" name="value2" value="value2"> </form> </body> This does work and the current page goes to the first form's action, but the second form is opened in a new window. This is caused by the target="_blank" but if I don't include this, only the first form is sent. Is there any way I can make the second form run but not follow it (ie make it run in the 'background') or suppress the new window from opening? These two forms have to be separate and use POST, not GET. I only want to follow the first form. (That brings up another question - is it possible to not follow a form at all?) Thanks! Hey everyone, I'm working on a new login form for my site and getting a HUGE headache from it. The login box houses 2 forms but I do some trickery with jQuery for the password field so that I can display the word "Password" in a text input, and then I swap it to a password type input field when the user focuses on it. - The form for logging in contains: Email field [type=text] Fake Password field [type=text] Actual Password field[type=pass] - Another to create a new account contains: Screename [type=text] Email[type=text] Password field[type=pass] Testing in FireFox, I clear the saved passwords/cache from the site, pull up the forms and submit the LOGIN form. It's successful and I choose to "Remember the password". Now I logout and pull up the forms again...and the SIGN UP form's password field, now contains the value I entered in the LOGIN form when I saved earlier. Does it simply look for all password fields on the page and add the value to them? The forms both have different ID's all the input fields have different ID's... I've never dealt with forms on this magnitude, so it may be easy, but man is it a headache! THANKS FOR ANY HELP! We're having difficulties dealing with two forms on one html search results page. We want the following to happen: 1) "next" and "previous" links to appear when the search returns more results than the limit set in the code. 2) the user to be able to click on a link/radio button which would allow them to view complete result data on another page. The code for goal 1 seems to need a "method = get" capability, while the second goal needs "method = post" to pass information on to the next page. We thought that the best way to do this would be to have two separate forms on the one html page. However, we can't seem to get either form to work in its entirety. Here's the code for our form with the "next" and "previous" links: Code: <form name = "form2" id="form2" method="get" action="<?php echo $_SERVER['PHP_SELF']?>"> When there is only this form on the page, the next/previous links work fine. It's when we try to incorporate other buttons (such as a submit button) and another form that things get messy. The same is true for the other form... it works fine by itself, but it's the combination that throws it off. Goal 2 form: Code: <form name = $formNum id = $formNum method=post action=seach_match_result.php target='_blank'> (This form has a submit button at the end.) These forms are not nested, but totally separated in the code. Are we on the right track, or is there a better way to accomplish this? Thanks! AM I'm new to forms and am trying to learn how to make a multiple page one. What I've made so far is very basic, but I figure I shouldn't make a pretty and complex one until I master the simple. I've made three separate pages: page a has the first part of the form and when you click 'continue' it should save the information and move you onto page b where you fill in another form. Then you move onto page c where the information you entered is displayed for you to review, then you press send. That's when it's sent to my e-mail. There are two problems with my code: when you click 'continue' on page A it automatically sends the info to my e-mail and I don't want it to. I want it to go to page b. It also displays the information entered on page a, but also shows a bunch of the code that should be hidden. I don't know why. And it's driving me nuts. I'd appreciate any help! Here's the code: <html> <head> <title>Sample Multiple Page Form</title> </head> <body bgcolor="white" text="#000000" link="#0000CC" vlink="#0000CC" alink="#0000CC" marginwidth=0 marginheight=15 topmargin=15 leftmargin=0> <form action="http://www.bluehost.com/bluemail" enctype="multipart/form-data" method="POST"> <input type="hidden" name="sendtoemail" value="contact@mywebsite.com"> <input type=hidden name="next_page" value="Multiple_Page_b"> <input type=hidden name="required" value="name:Name Required,email:e-Mail Address Required"> <input type=hidden name="current_page" value="Multiple_Page_a"> <input type=hidden name="form" value="2"> <input type=hidden name="start" value="1"> <center> <table width=450 cellpadding=4> <tr> <td colspan=2> <font size=2 face="arial" color=red> </td> </tr> <tr><td><font face="arial" size=2> Your Name: </td><td><input type=text name="name" value="" size=30> </td></tr> <tr><td><font face="arial" size=2> Email Address:</td><td><input type=text name="email" value="" size=30></td></tr> <tr><td colspan=2><br><input type="submit" name="next" value="Continue >>"></td></tr> </table> </form> </body> </html> And here's the message displayed when clicking continue: Thank you for completing our form. The following info was sent to contact@mywebsite.com: Field Value next_page Multiple_Page_b required name:Name Required,email:e-Mail Address Required current_page Multiple_Page_a form 2 start 1 name Jess email contact@myemail.com next Continue >> Hello all, Iam trying to use for loop / while loop (javascript) to create multi HTML input forms, but I have no idea how to do. Please help me out. Thank you! Daralis Please help. This is what I have so far http://bartletagency.com/m/x2.php Now, obviously with business cards there many different options. I need something to calculate on the side the total after picking each drop box option, or if easier, after hitting "calculate total." (preferably with the numbers in a table so I can make it appear by itself right underwear the send button) . Example: 1000 business cards in blue, say, would need to come up at 50 dollars if they pick 3-1, but if they pick 3-22 it needs to come up 60 dollars if they pick the other color, green, and pick 3-1, the label would need to turn to $55.00, if they pick 3-2 with the color green the label would need to say $65.00 how can i do this please? here is the code I have which made up the PHP file i linked you to above. code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head> <title>Lesson 3</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php if ($_SERVER['REQUEST_METHOD'] != 'POST'){ $me = $_SERVER['PHP_SELF']; ?> <h1 align="center">Business Cards</h1> <form name="form1" method="post" action="<?=$me?>"> <table border="0" align="center" cellpadding="5" cellspacing="0"> <tr> <td align="right" valign="middle">Quantity:</td> <td><select name="Quantity: "> <option value="1000">1000</option> <option value="2500">2500</option> <option value="5000">5000</option> <option value="10,000">10,000</option> </select> </td> </tr> <tr> <td align="right" valign="middle">color</td> <td><select name="color"> <option value="blue">blue</option> <option value="green">green</option> </select> </td> </tr> <tr> <td align="right" valign="middle">3</td> <td><select name="3"> <option value="small">3-1</option> <option value="medium">3-2</option> </select> </td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Send"> </td> </tr> </table> </form> <?php } else { error_reporting(0); // initialize a array to //hold any errors we encounter $errors = array(); // test to see if the form was actually // posted from our form $page = $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']; if (!ereg($page, $_SERVER['HTTP_REFERER'])) $errors[] = "Invalid referer<br>\n"; // check to see if a name was entered if (count($errors)>0) { foreach($errors as $err) echo "$err<br>\n"; echo "<br>Please use your browser's Back button to fix."; } else { // no errors, so we build our message switch($_POST['color']){ case 'red': $recipient = 'mathew420@gmail.com'; break; case 'green': $recipient = 'mathew420@gmail.com'; break; case 'blue': $recipient = 'mathew420@gmail.com'; break; default: $recipient = 'mathew420@gmail.com'; } $subject = "Widget On Line Order"; $from = stripslashes($_POST['Name']); $msg = "Message sent by $from\n"; $msg.="\nSize: ".$_POST['size']; $options=$_POST['options']; $msg.="\nOptions:"; if ($options) for ($i=0;$i<count($options);$i++) $msg.= "\n- $options[$i]"; else $msg.="\n- None"; $msg.="\nColor: ".$_POST['color']; $extension=($_POST['extension'])?"Extension: Yes":"Extension: No"; $wallmount=($_POST['wallmount'])?"Wallmount: Yes":"Wallmount: No"; $deskmount=($_POST['deskmount'])?"Deskmount: Yes":"Deskmount: No"; $msg.="\n$extension\n$wallmount\n$deskmount"; $msg.="\n".stripslashes($_POST['MsgBody'])."\n"; if (mail($recipient,$subject,$msg)){ echo "<p>Thanks for your order!</p>"; echo nl2br($msg); } else echo "An unknown error occurred."; } } ?> </body> </html> thanks so much i'm busy creating a form but, if i hit the send button i can only send it to e-mail. I want to have it so that if something is submitted it shows it on the page itself, Like if you make a offer on a site where you can buy stuff so other people on the site know what the highest offer is. But i dont know the code can someone plz help me Can somebody suggest a site where a can download an easy script to make my form work so that I can get it to my email? Thanks Hi Everyone. I'm looking for a way to make a form (only one input line) inwhich you write an URL, press submit and it'll send you to that url. not sure if it's only HTML stuff, but i just can't get how to do it. The form should act like the address bar. If you want to know why don't i just use the address bar, It's because I need to use Frames. Yes, I know it's kind of old, but i like it Thanks alot Chaim please help i am new to html and i am trying to add an optin form to my site that is linked to my e-mail can anyone help also the email address that the info needs to be sent to is glenwalker@grabtwitter.co.uk I have almost no knowledge of forms at all, and I need help... I need a form that makes one line with a button and a text box, the button should say "URL" and the text box should show the URL of a site. When you click the button it should highlight the URL in the text box. On the next line, another button that says "Image", and the text box has the URL of an image I have posted in my blog. Same here, when button gets clicked, it hightlights the URL in the text box. Simple? Hard? Can someone help a newbie? Here's an example of what I need: www.mycute.com Thanks! Helena hey guys im having trouble understanding how forms work. i know how to make forms
Code: <form action=""> Username: <input type="text" name="username"><input type="button" value="Check Availability"> <br /> <p></p> Password: <input type="password" name="password"> <br /> <p></p> Confirm Password: <input type="password" name="confirmpass"> <br /> <p></p> E-mail Address: <input type="text" name="email"> <br /> <p></p> Confirm E-mail: <input type="text" name="confirmemail"> <br /> <input type="submit" value="submit"><input type="reset" value="reset"> </form> but i dont really understand how to send that information to a different file, then later be able to get that information from the file and "log in". any help would be nice Hey I'm new to these forums and fairly new to html. I have a question about forms that everybody here probably be knows, but I'm new, so... here it goes. 1. How do I make a submit button that will submit the data entered in the forms before the submit button and send it to me? If I'm not clear enough just ask and I'll try to re-explain myself. How do we get better form boxes rather than the usual ones ? And does anyone know the code to make a the border of a form box glow when we move the mouse over them ? Thnx in Advance !! I need to do a form submission that assigns values to radio buttons. Basically its a subjective hearing test, like this one. http://www.entnet.org/healthinfo/hea...aring_test.cfm My question is I don't know how to setup the form at the point of submission, so it returns the proper response, dependent on the selected buttons(or score)? Does anyone have a clue? Thanks in advance... Hi can anyone help me I set up a website for a friend and added a form so clients could fill it in and make appointments. For some reason it doesn't seem to work properly. It works from my partners laptop and the main pc but on my laptop nothing happens , after clicking submit the form does not send . I have tried sending it with outlook express open and it still does jot work from laptop The html code is spot on and correct Anyone got any ideas Okay, I'm trying to make a form that sends the information entered to my email address. I don't know if it's the code or not but all it seems to be doing is opening up a blank email directed to the address. Here's the code: <form action="MAILTO:lifeisbetteroutsidethebox@hotmail.com" method="post" enctype="text/plain"> <p align="center"><strong>Your Full Name:</strong><br /><input name="name" type="text" class="style8" size="20"> </p> <p align="center"><strong>Your Email Address:</strong><br /> <input name="mail" type="text" class="style8" size="20" /> </p> <p align="center"><strong>Your City:</strong><br /> <input name="city" type="text" class="style8" size="20" /> <p align="center"> <input name="Send" type="submit" id="Send" value="Send"> <input name="Reset" type="reset" id="Reset" value="Reset"> </form> Okay, any help please? |