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

Simple POST problem I can not figure out

Status
Not open for further replies.

letmeoutofhere

Programmer
Jan 23, 2002
10
US
Hello, I am trying to use the POST process to pass variables from one form to another. Not fancy, however it is not working. Any ideas?

*****************
<html>
<head>
<title>Polling</title>
</head>

<body>
<h1>Poll </h1>

<p> Vole...</p>

<?$Age = 1?>;
<form method=post action=&quot;showpoll.php&quot;>
<input type=&quot;hidden&quot; name=&quot;test&quot; value=&quot;<?$Age?>&quot;>
<input type=submit value=&quot;Show Results&quot;></input>
</form>
</body>

*********************
showpoll.php contains:
<?
error_reporting(E_ALL);

$test = $HTTP_POST_VARS[&quot;test&quot;];

echo &quot;test = &quot;. $test;
?>


</html>

************************
The output has $test being empty.

Any ideas?

Thanks and sorry for the elementary question.

Jim
 
Actually, PHP as fairly decent error trapping. Not as good as it will be in PHP 5.0 (they're implementing things like &quot;assert&quot;, &quot;try/catch&quot;), but it's usable.

I have a FAQ in this forum (faq434-2999) which shows a code snippet trapping errors using a custom error handling function and the PHP function set_error_handler(). Want the best answers? Ask the best questions: TANSTAAFL!
 
SOrry for the slow response, but work as kept me buried and I have not been able to log back in to check responses.

I am sorry for not catching the Print statement in the first response. Shesh..

As for the PHP vs HTML, normally I only use PHP however, I had been working on resolving this for quite awhile before I posted the question so this was the final test of many many different attempts. I have over 20 years of programming under my belt so I am not new to this process...just the web portion of it.

Thanks for all the answers, sorry I didn't pick up on the print statement at the top of the post.

Jim
 
No one was chiding you for missing the response in the second post.

You had mentioned you weren't sure why it worked after you made the change, so I was saying why, and in our own defense explaining why we were over looking it.

And then sleipnir and I debated on why it was so easy for us to overlook.

Anyway, glad you got everything working.

-Rob
 
i thought that you had to start the script with

<?php track_vars?> [soapbox]
sleep is good
 
i thought when passing variables from a form using post you had to start your script that handles the form with <?php track_vars?> or is that old php3 stuff, or.... [soapbox]
sleep is good
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top