I have no idea why there is an error.. please advice.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Kian Wee
Forum Newbie
Posts: 2
Joined: Mon Sep 21, 2009 11:27 pm

I have no idea why there is an error.. please advice.

Post by Kian Wee »

learn.php
----------
<?php
$input = $_POST['msg'];
echo "You said: $input";
?>


index.html
-----------
<form action="learn.php" method="post">
Enter your message: <input type="text" name"msg" size="30" />
<input type="submit" value="send" />
</form>


After i input words and send/submit. This error appears when i preview it in DW:
Notice: Undefined index: msg in C:\localhost\learn.php on line 11
You said:

Or it shows a blank page when I access the file in my folder.

Thanks alot.
Griven
Forum Contributor
Posts: 165
Joined: Sat May 09, 2009 8:23 pm

Re: I have no idea why there is an error.. please advice.

Post by Griven »

You forgot the equals sign between name and "msg".

Also, please wrap your code in the [ code ] tags. It makes it much more readable.
Kian Wee
Forum Newbie
Posts: 2
Joined: Mon Sep 21, 2009 11:27 pm

Re: I have no idea why there is an error.. please advice.

Post by Kian Wee »

ahh... my bad. Such a simple mistake.

Code: Select all

<?php

echo 'Thanks alot Griven.'

?>
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: I have no idea why there is an error.. please advice.

Post by jackpf »

Try again?



:P
Post Reply