I am working thru the book PHP, MySQL and Apache from the Sams teach yourself library. On page 202 the exercise it to create an HTML input screen and then pass the variables to php. When I try my it opens my PHP listing but does not display it as a website. Any help would be appreciated.
Method POST
Collapse
X
-
Tags: None
-
Dormilich this is the line of code in the html form form action="send_si mpleform.php" method="POST". What happens next then it that the .php file is opened for editing instead of being the web page parroting what was written the html form.
I went to the book CD to copy the code from there thinking maybe I had a typing error that I wasn't seeing. Those files work the same as mine.
Suggestions?!Comment
-
this is the line from the html page which "calls" the php code.
<form action="send_si mpleform.php" method=post>
all pages are being displayed in the localhost server. I am using Apache for this.
If I change the entire process to be just one php text file with php code list on the top with the html code listed below with this command <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST"> in the html the process works.
So I am thinking it is something to do with the act of existing one file to go to another one. It is finding the called file just isn't running it. Any suggestions????
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST">Comment
-
yes they are. My problem started when I tried to send variables from a Html page to a php page.
These are my first attempts at using this technology. I am just working through excerises in a book to learn. Everything has worked thus far with the exception of branching out from a html to php. My thoughts are at this time that being able to do this branching would prove very powerful and useful.
thanks in advance for your response and help.Comment
-
here is the code (from the book examples....)
Code:<html> <head> <title>A simple HTML form</title> </head> <body> <form action="send_simpleform.php" method="POST"> <p><strong>Name:</strong><br/> <input type="text" name="user"></p> <p><strong>Message:</strong><br/> <textarea name="message" rows="5" cols="40"/></textarea></p> <p><input type="submit" value="send"/></p> </form> </body> </html>
Code:<?php echo "<p>Welcome <b>".$_POST["user"]."</b>!</p>"; echo "<p>Your message is:<br/><b>".$_POST["message"]."</b></p>"; ?>
thanks!Last edited by Dormilich; Jan 23 '12, 03:27 PM. Reason: please use [CODE] [/CODE] tags when posting codeComment
-
-
-
Sadly, the exact same thing happens in Chrome....inste ad of running the PHP code it opens the code in a text editor (note pad).Comment
Comment