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
https://forums.phpfreaks.com/topic/116531-form-php-mysql-problem/
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>

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.