hi, im new to php. im currently reading a book by Mcgraw-Hill and practricing my codes, i embedded this code in the body of my html: <form action="message.php" method="post"> Enter your message: <input type="text" name="msg" size="30"> <input type="submit" value="Send"> </form> <? $input = $_POST['msg']; echo "you said: $input"; ?> Code (markup): 1. the form shows, and allows me to enter the message 2. my problem is, when i click submit, it shows this error: Object not found! The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error. If you think this is a server error, please contact the webmaster. Error 404 localhost 06/28/07 08:34:49 Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e mod_autoindex_ thanks in advance
In your case page with your code should be named message.php not some_file.html name since you have PHP code. I think you are trying to post to an inexistent URL.
You need to add message.php in the same directory as the form. Message.php should contain the information needed to process the form.
It seems that u want to show the same page when u will submit it. So in this case it is not necessary to mention action="message.php" Code (markup): . Just leave it like action="" Code (markup): or action="<?php echo $PHP_SELF; ?>" Code (markup): . This will work.
Yes simply just make the form like so? <form action="" method="post"> Enter your message: <input type="text" name="msg" size="30"> <input type="submit" value="Send"> </form> <? $input = $_POST['msg']; echo "you said: $input"; ?> PHP: do you want the form when submitted do anything? like email? or go to database?
<?php if (isset($_POST['submit'])) { $input = (isset($_POST['msg'])) ? $_POST['msg']: ''; echo "you said: $input"; } ?> <form action="" method="post"> Enter your message: <input type="text" name="msg" size="30"> <input type="submit" name="submit" value="Send"> </form> PHP:
@ acecool, dannbkk,softnmore, fordp and gibex, thank u so much! actually im trying to insert a shoutbox in my dreamweaver site, but i don't know how to start.