HTML - Submitting 2 Forms With One Button
Hi guys
I trying to create a html page with php that links to an SQL DB,I currently have 2 separate forms that submit information to the DB when I click the button relating to that form.I am trying to create it so that I have one submit button and when I click that it will enter the information from both forms into that DB. Here is my code (HTML Page) Code: <html> <head> <title>update database</title> </head> <body> <form method="post" action="update.php"> title:<br/> <input type="text" name="solution" size="70"/></br> <input type="submit" value="Insert saved solution here"/> </form> <form method="post" action="update.php"> title:<br/> <input type="text" name="problem" size="70"/></br> <input type="submit" value="State the type of problem occurred"/> </form> </body> </html> (Seperate PHP Page) Code: <?php $solution = $_POST['solution']; mysql_connect ("localhost", "root","password") or die (mysql_error()); mysql_select_db ("heskdb"); $query="insert into hesk_std_replies (solution) values ('$solution')"; mysql_query($query) or die ('error updating database'); echo"database updated with:".$solution; $problem = $_POST['problem']; mysql_connect ("localhost", "root","password") or die (mysql_error()); mysql_select_db ("heskdb"); $query="insert into hesk_std_replies (problem) values ('$problem')"; mysql_query($query) or die ('error updating database'); echo"database updated with:".$problem; ?> Any help would be much appreciated Thanks Similar TutorialsHi all, I am currently trying to add a form onto a site. Everything looks fine visually, due to the aid of W3. I would like the information the user inputs, to get submitted to an email account inbox. That can be done cant it? I would like a page to come up to explain they have submitted there entry too. If anyone knows where I can find this out, that would be brilliant. (Below is what I have so far) Thanks Tom <div id="submit"> <form> <form name="input" action="mailto:XXXXXXX@beeb.net" method="get"> County: <input type="text" name="county"> <br><br> Town/City: <input type="text" name="town"> <br><br> Restaurant: <input type="text" name="restaurant"> <br><br> <input type="radio" name="level" value="star_1"> 1 star <br> <input type="radio" name="level" value="star_2"> 2 stars <br> <input type="radio" name="level" value="star_3"> 3 stars <br> <input type="radio" name="level" value="star_4"> 4 stars <br> <input type="radio" name="level" value="star_5"> 5 stars <br><br><br> Name: <input type="text" name="name"> <br> Email: <input type="text" name="name"> <br><br><br> <input type="submit" value="Submit"> </form> I'm able to create a form with a submit button. http://pastebin.com/nCnAiKZJ What I would like to be able to do is take this table/form and allow it to be viewed. I'm going to see if i can mail it to myself, but I would like to be able to create some kind of something for every submission. Ideally, I would like this some kind of something to exist on the website. This some kind of something would be clicked on to bring up a view of the filled in table/form. Hello, This may be a stupid question, but does anybody know how, if it is possible to submit a form by using just a link? In this situation, I want to submit a form without using a submit button. If anyone can help, that would be great. Hi everyone, I needs some help with image verification which I see on most websites these days. There is usually an image with blurred letters which are required to be typed into a field which verifys the user. Is this javascript? How would I implement this onto my webiste? Some links, code or other feedback would be much appreciated! Thanks Raggy Hi I'm writing code for a conference registration page, and having a friend write the php for it. I've never worked with forms before. How can I create an if statement that dosn't allow a viewer to submit their form if they have not filled out all the forms and also checked a confirmation text box? IE, an error box or page comes up if they have left a blank field and not clicked the text box. I know this involves at least some javascript so this may be the wrong forum. Thanks! When you type your email address into the text field and press submit, nothing happens. Here is my form code. I think everything is right on the database side... I didn't write it, or this, but I need to fix it xD I think the code was written in frontpage (I'm a notepad coder, myself), so there's some garbage in there. Any help would be appreciated. Thanks, Sondra Code: <form method="POST" name="e-newsletter" action="../librarynews-submit.asp"> <p>Email <input type="text" name="email" size="25"></p> <hr> <p> <input type="checkbox" name="teen" value="yes">Check this box if you would also like to subscribe to the QPL Teen Newsletter. </p> <!--<p><select size="1" name="Interest" multiple> <option selected>General</option> <option>Children's Activities</option> <option>Teen Events</option> <option>Adult Programs</option> <option>Book Sale Notification</option> <option>Friends of the Library</option> <option>New Arrivals</option> </select> <font face="Arial">Area of Interest</font></p>--> <p> <input type="submit" value="Submit" name="Submit"> </p> </div> </form> Hi all, I'm looking for ways, how I can avoid multiple form submissions, when a user repeatedly (intentionally or not) refresh the browser (F5 button) after submitting a form? The input in my form is simply an email address. Nothing else. It is used for forgot password function. I have tried unset or set the $_POST['email'] to empty, but it doesn't help. Is there a clever way to do this? I am trying to submit a forum through javascript, but the catch is I want to change the name of the button being sent through the form. Here is what I have here is the javascript function. Code: function form_submit(option) { if (option == 1) { alert("Option1") document.submit_form.DE_WEB_COMMAND.value = "Login"; document.submit_form.submit(); } else if ( option == 2 ) { alert("Option2"); document.submit_form["DE_WEB_COMMAND"].value="Activate"; document.submit_form.submit(); } } Code: <form action="/EN/cgi-bin/cgi_chip" method="post" name="submit_form" target="_blank" /> <input type="hidden" name="DE_LS_ATTM_USER_NM" value="" /> <input type="hidden" name="DE_LS_ATTM_USER_PSSW" value="" /> <input type="hidden" name="DE_WEB_PAGE_ID" value="login" /> <input type="hidden" name="DE_USER_VALUE" value="389740" /> <input type="text" id="username" name="DE_LS_IP_ATTM_USER_NM" tabindex="1" maxlength="20" value="" /> <input type="password" id="password" name="DE_LS_IP_ATTM_USER_PSSW" tabindex="2" maxlength="20" value="" /> <input type="submit" class="button" accesskey="l" tabindex="3" name="DE_WEB_COMMAND" value="Sign In" onclick="form_submit(1)" /> <input type="reset" accesskey="r" class="button" tabindex="4" name="Reset" value="Reset" /> <input name="DE_WEB_COMMAND" accesskey="E" type="button" class="button" value="New User? Enrol Now" onclick="form_submit(2)" /> </form> I have stripped out the formatting of the form. Anybody see why it doesn't work? I have a form and instead of clicking on a "Submit Button". I would like to have a text link that can be clicked to submit the action. Any ideas. This is the first time I've ever tried this so please bear with me. I created this with some html code: http://i.imgur.com/twTo2.png What I need this to do is when the person hits submit, it sends the text in each field to a file located on the web host. I need it to look something like this: http://i.imgur.com/WFYxa.png Here's the code I have (not sure if it will help): Code: <div id="welcom_pan"> <h2><span>submit your</span>VIDEO</h2><br> <p><form> YouTube Link to Video <br><input type="text" name="youtubelink" size ="50"/><br /><br /> Do you accept the rules (below)? <br><input type="radio" name="yes" value="yes" /> Yes <input type="radio" name="no" value="no" /> No<br /><br /> What's happening in the video? </form> <form method="post"> <textarea name="comments" cols="40" rows="5"></textarea><br> </form><br> <input type="submit" value="Submit" /> </p> </div> I'm having trouble with the submitting of a form. Here's my code: HTML Code: <form method="POST" action="example.php" name="r"> <br><br><table cellpadding="3%" cellspacing="0" width="30%" align="center"> <tr align="center"><td class="tablehead2" colspan="2">SCRIPT CHECK</td></tr> <tr align="center"><td class="mainnowidth2" colspan="2"><img src="captcha.php"></td></tr> <tr align="center"><td class="mainnowidth2">Enter Code:</td><td class="main2"><input type="text" name="code"></td></tr> <tr><td align="center" colspan="2"><input type="submit" class="subin" name="verify" value="Submit!"></td></tr> </table> </form> When i enter something into the text input and press the return key, the page loads but the script runs as if the POST data was never entered, but if i click the submit button or press tab and then return, it works fine. Can anyone suggest what the problem might be, and a possible solution? Thanks in advance for any help. What I want to have on my page is have what is submitted on a form to show up on the website. like a guestbook... How can I do that? Okay I've made a Form using html, and I need help on how to Submit it. I used "mailto:" which was a mistake I think... It always opens Microsoft Outlook even when that person doesn't use it, and has to download it. The easiest way for me to get the submissions would be from email, but I need something that will let you pick an email client or something... Just something simple. Any help? Hello everybody, If I have a simple form that I need to constantly submit, is their a way where I can add some information to the URL that will automatically click "submit" for me, nothing in the form needs to be filled out. Here is a copy of the form: <form method="post" name="vali"> <input type="submit" name="vote" value="Submit Form"> </form> This is the current format of the URL (PHP) http://abc.com/?action=1234&id=5678 I would greatly appreciate any help. Thanks, DreAdeDLyNcH ooh, its been a long time since i had to ask a question in here. i have a form that just wants to redirect to the home page, no matter what the action is. HTML Code: <form id="contactForm" method="post" action="index.phtml?file=contact.phtml" enctype="multipart/form-data"> <input class="input" name="contact_name" type="text" onfocus="if(this.value == 'Name:') { this.value = ''; }" onblur="if(this.value == '') { this.value = 'Name:' }" value="<?php echo (!empty($_POST['contact_name']) && $_POST['contact_name']) ? $_POST['contact_name'] : 'Name:'; ?>" /> <input class="input" name="contact_phone" type="text" onfocus="if(this.value == 'Phone:') { this.value = ''; }" onblur="if(this.value == '') { this.value = 'Phone:' }" value="<?php echo (!empty($_POST['contact_phone'])) ? $_POST['contact_phone']: 'Phone:'; ?>" /> <input class="input" name="contact_email" type="text" onfocus="if(this.value == 'E-Mail:') { this.value = ''; }" onblur="if(this.value == '') { this.value = 'E-Mail:' }" value="<?php echo (!empty($_POST['contact_email'])) ? $_POST['contact_email']: 'E-Mail:'; ?>" /> <textarea name="contact_message" cols="1" rows="1" onfocus="if(this.value == 'Message:') { this.value = ''; }" onblur="if(this.value=='') this.value='Message:'" /><?php echo (!empty($_POST['contact_message'])) ? $_POST['contact_message'] : 'Message:'; ?></textarea> <a href="#" class="right link1" onclick="document.getElementById('contactForm').submit()">Send</a> <a href="#" class="right link1" onclick="document.getElementById('contactForm').reset()">Clear</a> <input name="ContactSubmit" type="hidden" /> </form> and its not submitting. i think i messed up the link submits, what url shoudl be in there, when i put in index.phtml?file=contact.phtml it stays on the page but doesnt process. also, is the enctype correct for this type of post? also my doc type is xhtml strict, but i am going to have to satisfy a couple errors as far as that is concerned as well, its complaining about Quote: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag when i change the action even to itself which is /contact.phtml it still redirects to the home page. i have to ask it, what obvious fundamental have i forgotton? EDIT, ok it must be in the link submits, when i delete the href tag out of it completely, it seems to be processing. i cant figure out why the # sign was in there, whats supposed to be there for a link submit? i trued a url and that didnt work right So, I have made a form as a pre-LAN-event thing.. The problem is that I have never really used forms before and am not really that familiar with more advanced HTML besides simple layout stuff.. So my question is, how do I take the information from this form: HTML Code: <form name="input" action="Result.asp" method="get"> <font size="2" face="arial">Gender:<select name="gender"> <option value="male">Male</option> <option value="female">Female</option> </select> <br> Age:<select name="age"> <option value="12">0-12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25+</option> </select><br><br /> <b><u>What games do you want to see tournament in?</u></b><br /> <input type="checkbox" name="Game" value="CS16" /> Counter Strike 1.6<br /> <input type="checkbox" name="Game" value="CSS" /> Counter Strike Source<br /> <input type="checkbox" name="Game" value="LoL" /> League of Legends<br /> <input type="checkbox" name="Game" value="LoLD" /> League of Legends Dominion<br /> <input type="checkbox" name="Game" value="TF2" /> Team Fortress 2<br /> <input type="checkbox" name="Game" value="TF2" /> Left 4 Dead 2 Versus<br /> <input type="checkbox" name="Game" value="MC" /> Minecraft PvP<br /> <input type="checkbox" name="Game" value="BC" /> Bloodline Champions<br /> <input type="checkbox" name="Game" value="RoA" /> Rock of Ages<br /> Other: <input type="text" name="otherGame" /> (ex. 1, ex. 2, osv.) </font><br /> <input type="submit" value="Submit" /> </form> and submit it to another page so I can go on there and see how many males, females and people of different ages that have signed up, and what games they wanted. Sorry if it is a noobish question.. Thx in advance. - Ward, out! I have been trying to add a text field to a pre-existing form which is submitted to my email. It is an order form and I want to add an area for the user to input their country. It shows up on the webpage but when I get the information the user has submitted in my email the Country data is not coming through. The webpage is http://earfdn.org/form11.htm The problem is towards the bottom under the Ship To: title. Please help! And thank you so much for your time. Hi. I'm trying to clear a contact-form when when the user has pushed the submit button. Anyone know how to do this? The reason I want this is because a new window opens and tells the user that the message has been sent. And when this window is closed the message is still in the form. Hope i make myself clear Parashurama Hi, im fairly new to html, and was wondering how i would go about making a script to submit codes like on worldwaralliancecodes.com any help would be greatly appreciated. ive been searching for hours on google, but dont know what exactly to search for. Is there a connection between a form's "submit button" <input type="submit"> and it's "action/method/enctype" attributes <form action="url" method="post" enctype="text/plain">? Is there a difference between "submitting" a form and "posting" a form or is it all interconnected? Does the form's "action/method/enctype" attributes have to be set to allow the "submit button" to do anything? Do the "action/method/enctype" attributes have to be triggered by a "submit button"? Once I understand how this all works, I want to run some checks on user entries/selections in a form when the user clicks the submit button. These checks will be carried out by a JavaScript function. If there are problems with the user's selections/entries I want to; 1) suspend submission/posting 2) alert the user to the errors they have made via an alert box 3) allow the user to make corrections, then they click submit again 4) test the user's selections/entries again 5) if user's selections/entries are now OK, submit/post the form data or if still not OK go back to step 2 above. Any hints on how to do this? Maybe I should forget the submit button and use a command button? Is there a "submit" method I can place in a JavaScript function? |