Page 1 of 1
it's not working... why?
Posted: Mon May 27, 2002 6:00 am
by Nit
Hi,
I'm new to php and I'm trying to pass information from a form (html page) to a php page and write the data, simple just to get started...
this is what I did:
<?php
echo ("Your name is: $fName $lName")
?>
on the html page I have a form with two fields:
fName and lName.
why doesn't this work?
Thanks
Posted: Mon May 27, 2002 6:08 am
by volka
Posted: Mon May 27, 2002 6:11 am
by twigletmac
Posted: Mon May 27, 2002 6:13 am
by Tiimmy
Here's an example to work from:
Code: Select all
<?php
if ($submit) { // Check if form has been submitted.
echo('Your name is: $firstName $lastName.'); // If it has, display form results.
}
else { // If it hasn't, display the form.
?>
<FORM METHOD="post" ACTION="<?=$PHP_SELF?>">
<INPUT TYPE="text" NAME="firstName" VALUE="Enter First Name">
<INPUT TYPE="text" NAME="lastName" VALUE="Enter Last Name">
<INPUT TYPE="submit" NAME="submit">
</FORM>
<?
}
?>
That should be pretty much self-explanitory, but, if you still require more help, ask away!

now this won't work...
Posted: Mon May 27, 2002 6:15 am
by Nit
I added this:
register_globals=On;
and I got this error:
Parse error: parse error, unexpected '=' in c:\inetpub\wwwroot\php\test1.php on line 8
why?
Posted: Mon May 27, 2002 6:18 am
by Tiimmy
register_globals=On;
That belongs in the
php.ini file. That's the file where all of the configuration settings that PHP requires is stored. You can't run a PHP script with that in it.

Posted: Mon May 27, 2002 6:18 am
by volka
we can't tell you since we don't know line 8 of your script

it's alive!!!
Posted: Mon May 27, 2002 6:26 am
by Nit
Thanks everyone, it works! but I'll be back in the future with more questions!
bye