RE: [PHP] Transfer variable to next web-page
| From: | Matthew Loff | Date: | Sat, 17 Nov 2001 19:26:23 +0000 |
| Subject: | RE: [PHP] Transfer variable to next web-page | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75000@lists.php.net to get a copy of this message | ||
Richard already answered the variable part, but I thought I'd point out
that you need to use double quotes in your HTML tags... Single quotes
are incorrect...
<?
echo("<P>
<FORM method=\"POST\" action=\"join2.php\">
text for button
<INPUT type=\"submit\" value=\"Next step\">
<INPUT type=\"hidden\" name=\"htmlVariableName\"
value=\"$phpVariableName\">
</FORM>
");
?>
Or...
<?
echo('<P>
<FORM method="POST" action="join2.php">
text for button
<INPUT type="submit" value="Next step">
<INPUT type="hidden" name="htmlVariableName" value="'.
$phpVariableName
.'">
</FORM>
");
?>
Or... Better yet, why not just:
<P>
<FORM method="POST" action="join2.php">
text for button
<INPUT type="submit" value="Next step">
<INPUT type="hidden" name="htmlVariableName"
value="<?=$phpVariableName?>">
</FORM>
See the PHP manual for escaping HTML and string literals if you're
confused by any of this..
http://www.php.net/manual/en/language.basic-syntax.php#language.basic-sy
ntax.phpmode
http://www.php.net/manual/en/language.types.string.php
-----Original Message-----
From: Olav Drageset [mailto:olav@drageset.net]
Sent: Saturday, November 17, 2001 1:01 PM
To: php-general@lists.php.net
Subject: [PHP] Transfer variable to next web-page
I just started..
How do you transfer a variable from one web-page to another
I try to use a form like this:
<?
echo("<P>
<FORM method='POST' action='join2.php'>
text for button
<INPUT type='submit' value='Next step'>
<INPUT type='hidden' name='htmlVariableName'
value='$phpVariableName'>
</FORM>
");
?>
and catch it in join2.php by:
$phpVariableName=htmlVariableName;
echo"$phpVariableName";
This do not work.
Can anyone tel me what should be done
Neither books, php-manual nor HTML-specification does tel me.
Olav
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net