Subject: cannot pass parameters between forms
Posted By: deerebuck Post Date: 2/14/2004 6:11:34 PM
I run a linux red hat 9 server and am attempting to pass parameters between pages and nothing works. I am now down to the text.html and text.php with no luck. In fact none of the examples out of the book or off the web work. I know its me or my PHP setup. Can someone help the dummie here?
For your convenience:
Text.html
<HTML>
<HEAD></HEAD>
<BODY>
<FORM METHOD=GET ACTION="text.php">
Who is your favourite author?
<INPUT NAME="Author" TYPE="TEXT">
<BR>
<BR>
<INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>


Text.php
<HTML>
<HEAD></HEAD>
<BODY>
Your favorite author is:
<?php
echo $Author;
?>
</BODY>
</HTML>

Thanks in advance for your help!
Ron
Reply By: reign Reply Date: 2/15/2004 8:25:57 AM
Hi Ron,

I have the same problem and going through the history of topics found this suggestion from Nikolai.

http://p2p.wrox.com/archive/beginning_php/2002-11/17.asp
http://p2p.wrox.com/archive/beginning_php/2002-09/63.asp
http://p2p.wrox.com/archive/beginning_php/2003-02/3.asp
http://p2p.wrox.com/topic.asp?TOPIC_ID=4017

I will work on it now and let you know if I got it to work.

Reign

- Something is for free, if you never have to pay for it -
Reply By: reign Reply Date: 2/15/2004 8:57:24 AM
Changing the echo command to:

Your Favourite Author is:
<?php
echo $_GET['Author'];
?>

Did the trick on my server. (winxp / IIS)



- Something is for free, if you never have to pay for it -
Reply By: reign Reply Date: 2/15/2004 4:12:13 PM
You can do the same thing with the $_POST['variable'];
statement. Now I've ran into some other problems with this problem, so right now I'm using a trick to declare a value in the beginning of my statements giving the name as they appear in the book. for example on page 117 my php code reads following:

<?php
$Question1 = $_POST['Question1'];
if ($Question1=="Lisabon") echo "You are Correct, Lisabon is the right Answer";
if ($Question1!="Lisabon") echo "You are incorrect, Lisabon is the right Answer";
?>

Note that there's a typo in the book with the second answer.
Hope this helps you.

- Something is for free, if you never have to pay for it -

Go to topic 9771

Return to index page 948
Return to index page 947
Return to index page 946
Return to index page 945
Return to index page 944
Return to index page 943
Return to index page 942
Return to index page 941
Return to index page 940
Return to index page 939