<html>
<body>
<form action="welcome.php" method="post">
Age: <input type="text" name="age" />
<input type="submit" />
</form>
That's the HTML of it, I guess...I'm new to this so please go easy on me...That goes before the actual code.
<? if($age >= "18"); {
echo "Hello, you are $age "; }
else{
echo "Sorry, you are not the correct age."; }
?>
</body>
</html>
Hi,
I need a code that lets my customers upload a image file from their computer and then that file does 2 things
this is what I have so far, any improvements/additions on this code would really be appreciated...
1.//GET IMAGE INFO
2.
Thanks & regards,
Lokananth
Nah, PHP won't parse symbols like that, it will just print it back to the page.
Try this instead...
<?php
$form = "<form action=\"test.php\" method=\"post\"><input type=\"text\" value=\"\" name=\"one\"/><br/><input type=\"text\" value=\"\" name=\"two\"/><br/><input type=\"text\" value=\"\" name=\"three\"/><br/><input type=\"submit\" value=\"submit\" name=\"submit\"/></form>";
if($_POST["submit"])
{
if($_POST["two"] == "+") {$value = $_POST["one"] + $_POST["three"]; echo $_POST["one"] ." + " . $_POST["three"] . " = " . $value;}
elseif($_POST["two"] == "-") {$value = $_POST["one"] - $_POST["three"]; echo $_POST["one"] . " - " . $_POST["three"] . " = " . $value;}
elseif($_POST["two"] == "*") {$value = $_POST["one"] * $_POST["three"]; echo $_POST["one"] . " * " . $_POST["three"] . " = " . $value;}
elseif($_POST["two"] == "/") {$value = $_POST["one"] / $_POST["three"]; echo $_POST["one"] . " / " . $_POST["three"] . " = " . $value;}
else echo "You have entered an unknown operator!";
}
else echo stripslashes($form);
?>
Nice to see another PHP scripter out there :L lacks a few on this site hehe.
I must be bored or something.. but this would incorporate all your HTML & PHP together;
<?php
echo '<html>
<body>';
if (!$_POST) {
echo '<form action="' .$_SERVER["PHP_SELF"]. '" method="post">
Age: <input type="text" name="age" />
<input type="submit" />
</form>';
}
else {
$age = $_POST["age"];
if ($age < 18) {
echo 'You are too young';
}
else {
echo 'Welcome';
}
}
?>
And also, i don't think you should put your own work down....
lol failure....
and
Tags lamer
Sure its not the best script out there, but its your first PHP script. I know my first php script was
<?php echo "Hello World"; ?>
you wouldn't believe how much problems i had, firstly i had <?php hello world ?> i spent hours trying to get it to work, i ended up asking RussellReal and he told me i was missing the " and the ; but he wasn't going to tell me where.
We all start off at the same place, it doesn't matter what the quality of the script is, its worth the knowledge of what you gain from creating this script.