Jump to content

[SOLVED] html seems off...


dsandif

Recommended Posts

I trying to reverse engineer a php output. I've got the code, but I can't quite get the html to work with it.

 

her is the code:

<?php

    $age = 20;

    if ($age >= 18 && $age < 50) {

        print "You're in the prime of your life\n";

    } else {

        print "You're not in the prime of your life\n";

    }

?>

 

 

and here is the html:

<html>

<head></head>

<body>

<form action="age.php" method="post">

 

 

Enter your age: <input type="number" name="age" size="30">

<input type="submit" value="Send">

 

</form>

</body>

</html>

 

I am a beginner at this & trying to get better.Thanks for your input.

 

dsandif

 

Link to comment
https://forums.phpfreaks.com/topic/153098-solved-html-seems-off/
Share on other sites

PHP:

<?php
if(isset($_POST['submit']))
{
   $age = $_POST['age'];
   if ($age >= 18 && $age < 50) print "You're in the prime of your life\n";
   else print "You're not in the prime of your life\n";
}
?> 

 

HTML:

<html><body>
<form action="age.php" method="post">
Enter your age: <input type="text" name="age" size="30">
<input name="submit" type="submit" value="Send">
</form></body></html>

WAMP is installed correctly, so php is there, age.html and age.php are correctly named so the only thing I not clear is the invoking, although I have gotten another small php script to run, so I don't think its that either. Over all, everything looks goood, still not sure it won't run.

 

dsandif-

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.