Discussion Locked

PHP help

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a question about PHP and HTML forms. If I have a form and post it to a PHP script, it passes the input names as varibles. So I don't have to declare them in the script? Are the varibles Global to that script?

Chris

7 replies

by sachinp78

Yes the variables are global.
You can retreive all the variables using a single while loop.Script as follows

************************************
if (isset($HTTP_POST_VARS)){

//body Stores all the form inputs
$body = '';
//Iterate through all the Posted variables, and add them to the message body.
while (list($key, $value) = each($HTTP_POST_VARS)){
$body .= $key . ' = ' . $value . "\r\n";
}

This discussion is closed to new replies.