Jump to content

How to submit 2 fileds in one form.


ghosttr

Recommended Posts

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.

Link to comment
Share on other sites

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 ??? ??? ???

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.