Jump to content

form php mysql problem


matt121400

Recommended Posts

ok so i am making a form and i need 1 text box from a form to produce 2 seperate entries into the mysql for example when someone picks a state from a drop down menu i would like it to send New York and NY as seperate fields in mysql how would i go about this? i was thinking hidden fields possibly but i am new at this so i am not quite sure how to go about it.

Link to comment
Share on other sites

What I do to make things fast for programing is add the states to a table in mysql.

 

Like this

StateFullName  |StateAb  |  StateID

ALABAMA       |AL     |  1

 

From there I just do a query on the tables and pull back what is needed.

<tr>
    <td><strong>State:</strong></td>
    <td>
       <select name=\"AccountState\" size=\"1\">";
          
$sql149 = "SELECT StateFullName, StateAb FROM states";

if ($result149 = mysql_query($sql149)) {
  while ($row149 = mysql_fetch_assoc($result149)) {
    $selected = ($row149['StateAb']==$Wisconsin)?" selected=\"selected\"":"";
   echo "<option value=\"{$row149['StateAb']}\"{$selected}>{$row149['StateFullName']}</option>";
  }
}

echo      " </select>
      </div></td>

     </tr>

Link to comment
Share on other sites

ok well my situation is kinda wierd im using a macro program and would like to pull the info from 1 table and some of the things the macro fills out has NY and MN and so on for their drop down menus and some have New york and Minnesota as the choices so what i would need is to have Mn in 1 colum and Minnesota in the next column as i am writing each sites macro individually and can pick and chose which column goes in which site anyway so ya that is why i need 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.