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!

Getting HTML form keys

Status
Not open for further replies.

mpopnoe

Programmer
Feb 28, 2002
47
US
In ASP the request object has the key function allowing you to locate a value by location rather than name (handy on a dynamic form). I know about the $_REQUEST variable in PHP4 which I'm guessing I am to use. The php manual didn't make it clear for me so I was hoping someone could help me out. The ASP version that I am currently converting used the count of the request object to set upper limit for the loop and the key function to grab each location I needed from the dynamic form, then passed the key value to the item function for the value. I'm hoping to find a similar approach in PHP4 since it works so well in ASP.

thanks,
mike
 
ASP:
for each(item in Request.Form)
Response.write &quot;Element Name: &quot; & item & &quot;<br />&quot; & _
&quot;Element Value: &quot; & Request.Form(item) & &quot;<hr />&quot;
next

PHP:
foreach($HTTP_POST_VARS as $key=>$value) {
print(&quot;Element Name: &quot; . $key . &quot;<br />&quot; .
&quot;Element Value: &quot; . $value . &quot;<hr />&quot;
} //end foreach

hth leo

------------
Leo Mendoza
lmendoza@garbersoft.net
 
sorry got cut short.

anyways, I wasn't totally sure what you needed, but the above method should easily tell you how to get all the keys and what not from the form array.

if you need more help, please post again leo

------------
Leo Mendoza
lmendoza@garbersoft.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top