Link to home
Start Free TrialLog in
Avatar of systemx
systemx

asked on

passing values?? between pages

problem:

i can't seem to be able to pass values from one page to another..
ok, i start with a HTML page with a form, then submit the info to the .php file..
the .php can't seem to read the variables?

here is the .html code
please advise..

is there some config i didn't do to the server?

--form.html

<HTML>
<head>
<title>form.html</title>
<META NAME="Generator" CONTENT="EditPlus">
</head>
<body>
<form action = "form.php" method = "get">
<table align = "center" border = 1 >
<tr>

<TD><font size=5><b>name</b></font></TD>
<TD><input type="text" name="name" size ="20"></TD>
</tr>
<tr>

<TD><font size=5><b>phone number</b></font></TD>
<TD><input type="text" name="phone" size="20"></TD>
</tr>
<tr>

<TD width="134" height="38" align="center">
<input type="submit" value="Yes" name="Yes"></TD>
<TD width="190" height="38" align="center">
<input type="Reset" value="Reset" name="reset"></TD>
</tr>
</table>
</form>
</body>
</HTML>

here is the .php code

--form.php

<?php
echo"<table align=center>";
echo"<TR><TD><font size=5>name</font></TD>";
echo"<TD><font size=5>$name</font></TD>";
echo"<TR><TD><font size=5>phone number</font></TD>";
echo"<TD><font size=5>$phone</font></TD>";
echo"</table>";
?>


--It is now proved beyond doubt that smoking is one of the leading causes of statistics.
ASKER CERTIFIED SOLUTION
Avatar of DoppyNL
DoppyNL

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of systemx
systemx

ASKER

ahh .. it works!
but why do i have to use $GET?
in the text book, they don't use get?

thanks anyways?
 :D
old book?

depends on server configuration if you can do without $_GET or not.
with allways works, so you're better of using $_GET['name'] all the time (then it will work on all servers).
systemx,

It depends on which version of PHP you're using.

Anything past about 4.1.0 you'll need to use $_GET, $_POST, etc.
Your manual may have been written for an older version...?

Peter.
You have to use get if you have global variables turned off in your php.ini file.  It is off by default, which is good because it can lead to security problems.  Stick with $_GET
Avatar of systemx

ASKER

Ahah! thanks guys..
yeah, my book is using version 3.xxx
i have a new book now.. i will burn the other one for wasting my time!!
:D
thanks again..