Hi I am an absolute beginner in PHP and I need a small clarification.
I watched two video tutorials, both of them are good but what they varies.
Say I have this simple html form:
<form action = "1.php" method = "post">
Name: <input type ="hidden" name = "posted" value = "true">
<input type = "text" name = "shan">
<input type = "submit" value = "submit">
1 tutorial says that output for name will be received as the value of variable $_POST('shan')
The other tutorial says that it will automatically assigned to the variable $shan in the processing page.
I tested both:
<?php
// some training videos say that this will work but it doesn't
if(isset($posted))
{
echo $shan;
}
// This certainly works
if (isset ($_POST['posted']))
{ echo $_POST['shan'];}
?>
You see that I have commented, that the first 'if' statement doesn't output anything but the second one does. Why doesn't the first own work... (In the video tutorial the tutor was actually showing an example and it worked for him)
Probably, does this work only for older versions?



Reply With Quote



Bookmarks