Jump to content

Problems with forms


Tabularasa

Recommended Posts

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.