Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Help]Can't see what is wrong here..

Can't kilean the zilean
Loyal Member
Joined
Oct 20, 2010
Messages
1,182
Reaction score
515
The classic, code works no idea why, vs code doesn't work, no idea why.
Just seeking a fresh pair of eyes. All help is appreciated :)


Code:
<html>
<body>
<form action="welcome.php" method="post">
	Name: <input type="text" name="fname" />
	Age: <input type="text" name="age" />
<input type="submit" />
</form>

</body>
</html>


PHP:
<html>
<body>

<?php
function writeName() {
	$fname = $_POST["fname"];
	echo $fname;
	$age = $_POST["age"];
	if ($age < 21) {
		echo $age;
		echo "Katty Perry is Dank";
	} else {
		echo $age;
		echo "Dank fuel can't melt jet memes";
	}

}

echo "My name is ";
writeName();
?>

</body>
</html>
 
Joined
Dec 15, 2009
Messages
1,387
Reaction score
236
Code:
<?php 
function writeName() { 
    $fname = "Chai";  
    $age = "2"; 
    if ($age < 21) { 
        $msg = "Katty Perry is Dank"; 
    } else { 
        $msg = "Dank fuel can't melt jet memes"; 
    } 
	echo "My name is $fname $age $msg";

} 
writeName(); 
?>

I would've written it this way. Btw, what's the question again?

--
I think I may have realize what you're trying to point out.

Main page
<html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>

</body>
</html>

Welcome.php
<html>
<body>

<?php
function writeName() {
$fname = $_POST["fname"];
echo $fname;
$age = $_POST["age"];
if ($age < 21) {
echo $age;
echo "Katty Perry is Dank";
} else {
echo $age;
echo "Dank fuel can't melt jet memes";
}

}

echo "My name is ";
writeName();
?>

</body>
</html>

Right?

-
When a form is been submitted, the link referral will be redirected with specific headers which contains the data:

ErQZTch - [Help]Can't see what is wrong here.. - RaGEZONE Forums


Feel free to correct me if I'm wrong.
 

Attachments

You must be registered for see attachments list
Last edited:
Can't kilean the zilean
Loyal Member
Joined
Oct 20, 2010
Messages
1,182
Reaction score
515
No thats good, thanks very much!
 
Back
Top