Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connect a variable then split it

Status
Not open for further replies.

ThomasJSmart

Programmer
Sep 16, 2002
634
i need to get values from 2 tables out of a mysql database,
table1 = first
table2 = name

in my html form i have a select thing, i need the names from the database to apear in the menu as a single name.
so i made 2 variables

$n1 = $myrow[first];
$n2 = $myrow[name];

and put them in the option tag
<OPTION value='xxx'>&quot;.$n1.&quot; &quot;.$n2.&quot;</OPTION>

this gave me a menu with a list of names,
option1 = James Peach
option2 = Lucy Cherry
option3 = Sally Apple

now the difficult part, the names are gotten from the &quot;names&quot; table and i need to submit this form into the &quot;msg&quot; table.

also i need the name that has been combined above to be seperated and put into seperate &quot;firstname&quot; &quot;surname&quot; coloms.

i tried to change the value field of the select option like this (the name of the select menu being &quot;first&quot;:
<OPTION value='&quot;.$n1.&quot;&name=&quot;&quot;.$n2.&quot;'> but it wouldnt work.

any help appreciated,
thnks
Thomas
 
why dont u pass id(if u have the column) and retrieve the record from it.
ie.
$id = $myrow['id'];
<OPTION value='$id'>&quot;.$n1.&quot; &quot;.$n2.&quot;</OPTION>
and while puting in msg table get the first and name from the id user has selected from sql query like..
select first,name from tablename where id=$id ;
and insert it into msg table...

--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top