Undefined index:

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Re: Undefined index:

Post by johnj » Mon Jul 22, 2013 10:26 pm

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

Re: Undefined index:

Post by rupali » 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

Who is online

Users browsing this forum: Baidu [Spider] and 4 guests