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!

fetching a variable from form

Status
Not open for further replies.

jeanpaul

Technical User
Aug 13, 2000
20
0
0
SE
I am using MySQL and one checkbox has this name in a form;

NAME=show".$row['brokershort']

Let's say that the brokershort=aza so this name will be showaza. This works but I want it to be remembered after posting this form. The problem is that I have several brokershort so I use a loop. Another brokershort=ttr. I thought that I could solve this using;

$show="show";
$broker=$row['brokershort'];
value=$$show$broker

These lines are printing out $showaza and $showttr but doesn't fetch the variable(the value of $showttr). How do I solve this?

Thanks / Henrik
 
I believe you mean you have a form with more than one checkbox?
If so, just make a loop inside the form, something like

while($row = mysql_fetch_array(someResult)){
$name = "show".$row["brokershort"];
print(&quot;<input type='checkbox' name='$name'>$name<br>&quot;);

This will give you (X being a checkbox):

X showaza
X showttr
...

When you submit the form you'll have the variables $showaza and $showttr, with a value depending on whether the checkbox was checked or not.

Hope I understood your question right :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top