Problems with variable handling !
| From: | php-general | Date: | Tue, 08 Jun 2004 10:36:42 +0000 |
| Subject: | Problems with variable handling ! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-187866@lists.php.net to get a copy of this message | ||
Hi !
I have a Problem with hand over of variables;
My Page consists of three files which I have enclosed to
demonstrate the problem.
test.php:
----------------------
<html>
<head>
<title>test.php</title>
</head>
<frameset rows="274,*" cols="*" framespacing="1"
frameborder="yes" border="1" bordercolor="#000000">
<frame src="test_oben.php" name="topFrame" scrolling="YES">
<frame src="test_0.php" name="buttom0Frame" scrolling="YES">
</frameset>
<body>
</body>
</html>
----------------------
test_oben.php:
----------------------
<html>
<head>
<title>test_oben.php</title>
</head>
<body>
<p><u>test</u></p>
<form action="test_0.php" method="post"
enctype="multipart/form-data" name="form1" target="buttom0Frame">
<table width="856" height="30" border="0">
<tr>
<td width="77" height="26"
align="right">String1</td>
<td width="223"><input name="var1" type="text"
id="var1" size="25" maxlength="25"></td>
<td width="178" align="right">String2</td>
<td width="206"><input name="var2" type="text"
id="var2" size="25" maxlength="25"> </td>
<td width="150"><input name="button1" type="submit"
id="button1" value="Display strings">
<input name="button2" type="submit" id="button2"
value="Display concatenated strings"></td>
</tr>
</table>
</form>
</body>
</html>
----------------------
test_0.php:
----------------------
<html>
<head>
<title>test_0.php</title>
</head>
<body>
<?php
if ($button1)
{
echo "Button 1 was pressed\n, ";
echo "String1=$var1\n, ";
echo "String2=$var2\n, ";
$var3 = "$var1$var2";
/*echo "concatenated string=$var3";*/
}
if ($button2)
{
echo "Button 2 was pressed\n, ";
/*echo "String1=$var1\n, ";
echo "String2=$var2\n, ";*/
echo "concatenated string=$var3";
}
?>
</body>
</html>
----------------------
In test_oben.php I want to insert two strings.
pressing the "Display strings"-button will output them in the button frame.
Only pressing the "Display concatenated strings"-button should output the concatenated
string,
but this does not work, and I do not understand why.
Please give me a hint !
best regards
chrm