• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[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

Right?

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



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!