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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP Cannot figure very simple stupid question out.

Status
Not open for further replies.

rbaron

Programmer
Dec 14, 2002
6
US
This is an extremely newbie question but I cannot figure out why this does not work. I have two forms one html that allows the user to enter a value in val1. The user submit and it goes to the second form calculate.php.
That form is supposed to display the value of the calculate_form.html. It does not, and I have tried about two thousand variations. I am stuck and apparently struck stupid. Any help would be greatly appreciated.

Here is the form and hence the problem. I checked other posts and found that the register_globals is set to on. I also see that the form method of php is set to GET. I tried that as well and although I could see the get results in the url I could not get it to display.


calculate_form.html

<HTML>
<HEAD>
<TITLE>New Page 1</TITLE>
</HEAD>
<BODY>
<FORM METHOD=&quot;POST&quot; ACTION=&quot;calculate.php&quot;>
<P>Value 1: <INPUT TYPE=&quot;text&quot; NAME=&quot;val1&quot; SIZE=10></P>
<P><INPUT TYPE=&quot;submit&quot; NAME=&quot;submit&quot; VALUE=&quot;Calculate&quot;></P>
</FORM>
</BODY>
</HTML>
----------------------------------------------------------
calcualte.php

<?php
$result=($_POST[val1]);
?>

<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<?php
echo $result;
?>

</BODY>
</HTML>
 
Just tried that method with the same results. No information is displayed. I changed the METHOD to $GET with the code you supplied and same result. Although the get method does list this in the url address


Which is correct.

Here was the syntax that I used.

<?php
$result=$_GET['val1'];
?>

<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<?php
echo $result;
?>

</BODY>
</HTML>
 
I tried both $POST and $GET with the same result. I see you reference PHP version I am using 4.2.3. I thought $POST was the correct syntax but when I apply it it does not display the value of val1.

I am knew to PHP but not to programming and this is driving me nuts.

Rick
 
These did not work either. There must be some problem with my PHP. I will contact my ISP and see if they can help. Thank your for the assistance.

Rick

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top