Tabularasa Posted October 24, 2007 Share Posted October 24, 2007 Good evening, I am discovering php and would like to play with forms. I have created the following form test2.php <html> <body> <form action="welcome.php" method="GET"> <p>Your name: <input type="text" name="name"></p> <p>your age: <input type="text" name="age"></p> <p><input type="submit"></p> </form> </body> </html> I have then created the welcome.php called by test2.php. Both forms are in the same folder. welcome.php <html> <body> <p>Test: <?php echo "Success"?></p> <p>Hi <?php echo htmlspecialchars($_GET['name'])?></p> <p>You are <?php echo (int)$_GET['age']?> years old</p> </body> </html> I then open test2.php with Firefox. I enter the required input ("Tabularasa","32") and hit submit. I am then redirected toward welcome.php with my browser window showing: file:///C:/wamp/www/test/welcome.php?name=Tabularasa&age=32 However, once I am on welcome.php is only see the following: Test: Hi You are years old looks like php is not returning anything. The funniest thing is that when I run welcome.php under the debug window of phpDesigner I at least get Test: Success which isn't the case when I open welcome.php directly with Firefox. What is happening? Quote Link to comment https://forums.phpfreaks.com/topic/74652-problems-with-forms/ Share on other sites More sharing options...
trq Posted October 24, 2007 Share Posted October 24, 2007 How are you accessing these pages in your browser? You need to have a web server setup and use http://localhost/filename.php in the address bar. You can't simply open the files using your browser. Quote Link to comment https://forums.phpfreaks.com/topic/74652-problems-with-forms/#findComment-377352 Share on other sites More sharing options...
unidox Posted October 25, 2007 Share Posted October 25, 2007 Thorpe is right, I use apache,mysql,and php on my home machine for local testing. Google on setting up apache and then you can view locally. Otherwise you have to upload to a web server. Quote Link to comment https://forums.phpfreaks.com/topic/74652-problems-with-forms/#findComment-377408 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.