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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hidden value in <select> 1

Status
Not open for further replies.

ag1060

Programmer
Aug 26, 2011
27
0
0
US
Hey guys,

I have a small problem. I want to pass hidden name 'pid' to a select dropdown box. Any idea on how to do that? This is what I have:

Code:
	<select name="project" class="select">
	
 	 $show_project_list
		</select>


The $show_project_list basically prints data from a db:

Code:
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)) {



$show_projects.=<<<EOF

<option value="$row[pid]">$row[ptitle]</option>


EOF;

I am not sure where to pass the hidden name "pid on a select and how to grab the data". If it was a textbox, I would have done something like this:
Code:
	  <input type="text" name="stag" />
	  <input type="hidden" name="pid" value="$pid">

I hope i'm not confusing anymore. Thanks in advance.
 
you are confusing me.

what is the point of applying a hidden 'value' to a select box? is the value different for each option of the select? or is the value static for the form?

if the former, then your best bet is to do what you are doing and storing the unique value as the option's value. assuming you can derive the actual option value from the unique pid.

if the latter, then just add a hidden field to the form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top