ghosttr Posted September 21, 2007 Share Posted September 21, 2007 I have 2 fields that i need sent with one form, but I only need the user to see 1 form when submitting. Can anyone tell me how this can be accomplished? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted September 21, 2007 Share Posted September 21, 2007 what? you say 2 fields 1 form, but then say 2 forms 1 field Explain yourself better first Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 21, 2007 Share Posted September 21, 2007 you need a hidden input field. Quote Link to comment Share on other sites More sharing options...
inspire Posted September 21, 2007 Share Posted September 21, 2007 ok...the method is.. - define page1.php with form tags as <form action="page2.php" method="post"> - inside the page1.php add some hidden or text fields and a submit button( input type='Submit') - on page2.php define $new=$_POST['x']......x=the textbox or hidden field value -echo the $new; .... you will see the posting there. Quote Link to comment Share on other sites More sharing options...
ghosttr Posted September 21, 2007 Author Share Posted September 21, 2007 Im trying to make a form that stores standing information for a game. Problem is that the games browser is picky, and will only use php/html. I have setup the database and made some forms Here is a picture of what im stalking about http://dl.eve-files.com/media/0709/changewindow.PNG I used an invisible form to do it, and at first i thought it worked. But unfortunately it only worked for the first field :'( Here the the code for 1 row in this page <tr> <td><A href=showinfo:16159//<?php print $results[0]['id'];?>><?php print $results[0]['name'];?></A></td> <td><font color=#<?php print $results[0]['color']; ?>>|||||||||||||||||||||||||||||||||||</font></div></td> <td><form action="Untitled-1.php" method="post" > <select name="select" id="select"> <option value="<?php print $results[0]['color']; ?>" selected>Keep Standings</option> <option value="3300FF">+10</option> <option value="3399FF">+5</option> <option value="FFFFFF">Neutral</option> <option value="FF9900">-5</option> <option value="FF0000">-10</option> <option value="33FF00">Self</option> </select> <input type="hidden" name="id" value=<?php print $results[0]['id'];?> id="allianceid"> </form><input type="submit" name="select2" id="select2" value="Submit"> </td> </tr> And heres for how i am updating the database $first=$_POST['select']; $second=$_POST['id']; $query1 = "UPDATE evealliances SET color ='$first' WHERE (id='$second')"; mysql_query($query1); What i need is to be able to get all of these working, either with 1 or multiple submit buttons. I know i can create unique forms, buttons and queries. For each row, but there are over 50 rows here. And there has to be a better way to do it ??? ??? ??? Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 21, 2007 Share Posted September 21, 2007 First of all don't end your form before your submit button. Secondly, you could put the data in the session instead of posting it. Post values can easily be edited. Quote Link to comment Share on other sites More sharing options...
ghosttr Posted September 21, 2007 Author Share Posted September 21, 2007 So if i put the submit button with the form does that mean I have to have a button for every form? And is there any way for it to get all of the data then organize it so it can go into the database? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.