Undefined index:

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply

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


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">

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

Post Reply