Undefined index:

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply

rupali
New php-forum User
New php-forum User
Posts: 140
Joined: Thu Oct 13, 2011 10:32 pm
Location: Chandigarh, INDIA

Tue Jul 23, 2013 5:08 pm

Hi,

Use isset() at the first line of php code like this and assign the name to submit button :
<form name="form1" method="post">
<input type="text" name="name">
<input type="submit" value="login" name="submit">
</form>
<?php
if(isset($_POST['submit']))
{

$name = strtolower($_POST['name']);
if ($name=="sandeep") {
echo "Welcome ".ucfirst($name).".";
} else {
echo "Hello ".ucfirst($name).", You are not authorized.";
}
}
?>

Post Reply
  • Information
  • Who is online

    Users browsing this forum: Bing [Bot] and 4 guests