...

View Full Version : Error: Notice: Undefined index



phill_ridout
07-25-2007, 07:07 PM
Im new to this PHP stuff, i've been trying it since monday and its 50 times easier than i thought it would be :-). I understand why im getting the following errors, but how can i iliminate it?


Notice: Undefined index: UsrEml in C:\Program Files\EasyPHP 2.0b1\www\login.php on line 8

Notice: Undefined index: UsrPwd in C:\Program Files\EasyPHP 2.0b1\www\login.php on line 8



<?php

if ($_POST["UsrEml"] || $_POST["UsrPwd"])
{
echo "Processing Page"
}
else
{
?>
<form action='login.php' method='post'>
<label for='UsrNme'>Email Address: </label><input id='UsrEml' name='UsrEml' type='text'>
<label for='Pwd'>Password: </label><input id='UsrPwd' name='UsrPwd' type='password'>
<input type='submit'>
</form>
<?php
}
?>


Thanks in advance!

whizard
07-25-2007, 07:13 PM
try

if(!empty($_POST['submit']))
{
//Processing page
}
else
{
//Show form
}


To do that, you also have to add name="submit" to your submit button .

HTH
Dan

phill_ridout
07-25-2007, 08:05 PM
thanks, its so easy, i dunno why i even dreaded trying php and mysql, its so easy! :-D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum