I am a nebie to php..
I have two simple pages that pass info from one to the next. If I upload the files to a server running php, the pages work fine.
However, I have installed php on my local machine and need to do my testing from here. When I try to run the script, it causes a problem when a variable is not set. Is there a way around this(other than isset() test)? register_globals is set to ON on the server but not my local machine...im guessing that that may be the problem. I understand though that there are security issues when it is set to on.
here are my pages..
'check.html'
<html>
<body>
<form method = post action = "check.php">
Have you ever eaten haggis before?
<input name = "Choice1" type = "checkbox" value = "Haggus">
<br>
Have you ever eaten snails before?
<input name = "Choice2" type = "checkbox" value = "Snails">
<br>
Have you ever eaten locusts before?
<input name = "Choice3" type = "checkbox" value = "Locusts">
<br>
<br>
<input type = submit>
</form>
</body>
</html>
'check.php'
<html>
<head></head>
<body>
<?php
echo $_POST['Choice1'] . "<br>";
if (isset($_POST['Choice2']))
echo $_POST['Choice2'] . "<br>";
echo $_POST['Choice3'] . "<br>";
?>
</body>
</html>
The if statement does solve the problem but what other options do I have? Also, if register_globals is ON, does that mean that there is an immediate security problem?
CES
I have two simple pages that pass info from one to the next. If I upload the files to a server running php, the pages work fine.
However, I have installed php on my local machine and need to do my testing from here. When I try to run the script, it causes a problem when a variable is not set. Is there a way around this(other than isset() test)? register_globals is set to ON on the server but not my local machine...im guessing that that may be the problem. I understand though that there are security issues when it is set to on.
here are my pages..
'check.html'
<html>
<body>
<form method = post action = "check.php">
Have you ever eaten haggis before?
<input name = "Choice1" type = "checkbox" value = "Haggus">
<br>
Have you ever eaten snails before?
<input name = "Choice2" type = "checkbox" value = "Snails">
<br>
Have you ever eaten locusts before?
<input name = "Choice3" type = "checkbox" value = "Locusts">
<br>
<br>
<input type = submit>
</form>
</body>
</html>
'check.php'
<html>
<head></head>
<body>
<?php
echo $_POST['Choice1'] . "<br>";
if (isset($_POST['Choice2']))
echo $_POST['Choice2'] . "<br>";
echo $_POST['Choice3'] . "<br>";
?>
</body>
</html>
The if statement does solve the problem but what other options do I have? Also, if register_globals is ON, does that mean that there is an immediate security problem?
CES