Tuts
08-06-2012, 11:46 AM
I'm currently using XAMPP and practising some PHP, however I've stumbled across a small problem.
I won't post all of my code as it's extremely long, so I'll post a section of it. We're dealing with buttons and performing actions after a button has been pressed.
<input type="submit" name="submit" />
<?php
if($_POST['submit'])
{
echo 'You\'ve pressed the submit button!';
}
?>
This piece of code throws this error, Notice: Undefined index: submit in C:\xampp\htdocs\test.php on line 4 (Line 4 is this code - if($_POST['submit'])). Does anyone know the problem with this code? When I click on the submit button, it doesn't echo out "You've pressed the submit button!".
Help would be appreciated.
I won't post all of my code as it's extremely long, so I'll post a section of it. We're dealing with buttons and performing actions after a button has been pressed.
<input type="submit" name="submit" />
<?php
if($_POST['submit'])
{
echo 'You\'ve pressed the submit button!';
}
?>
This piece of code throws this error, Notice: Undefined index: submit in C:\xampp\htdocs\test.php on line 4 (Line 4 is this code - if($_POST['submit'])). Does anyone know the problem with this code? When I click on the submit button, it doesn't echo out "You've pressed the submit button!".
Help would be appreciated.