Jump to content

Can anyone help me fix this php code?


jbeannie05

Recommended Posts

you should be checking to make sure that the submit button has been pressed before attempting to output the $_GET values.

 

<form action="" method="get">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" name="submit" />
</form>

<?php
if(isset($_GET['submit'])) {
?>
Welcome <?php echo $_GET["fname"]; ?>.<br />
You are <?php echo $_GET["age"]; ?> years old!
<?php
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.