HabbDance
24-11-2008, 11:51 PM
Ok, first off, I'm new to PHP. I am sure this is all horribly wrong so don't yell at me or say something like 'FAIL GTFO' :P
Can someone just look this over and tell me if it will work and how to fix it?
BTW, I'm sure the $to variable is wrong
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Job Application</title>
<style type="text/css">
<!--
body {
font-family: tahoma;
font-size: 11px;
font-weight: bold;
-->
</style>
</head>
<body>
<?php
if( ! $_POST[ 'submit' ] ) {
echo '<form action="" method="post">
Real Name:<br /><input type="text" name="name" /><br />
Age:<br /><input type="text" name="age" /><br />
Habbo Name:<br /><input type="text" name="habbo" /><br />
Job Applying For:<br /><input type="text" name="job" /><br />
Experience:<br /><textarea rows="2" cols="20" name="experience"></textarea><br />
Message:<br /><textarea rows="2" cols="20" name="message"></textarea><br />
<input type="submit" name="button" id="button" value="Submit" />
</form>';
} else {
$headers .= 'To: Me <[email protected]>' . "\r\n";
$headers .= 'From: <[email protected]>' . "\r\n";
$subject = '$_POST[ 'habbo' ] - Job Application';
$to = $_POST[ 'email' ];
$message = $_POST[ 'name' ] <br /> $_POST[ 'age' ] <br /> $_POST[ 'habbo' ] <br /> $_POST[ 'job' ] <br /> $_POST[ 'experience' ] <br /> $_POST[ 'message' ];
mail($to, $subject, $message, $headers);
}
?>
</body>
</html>
Thanks.
PS - I got the original script from another thread so credit to whoever posted it ;)
EDIT: tested it and it says this:
Parse error: syntax error, unexpected T_STRING in /homepages/34/d237406810/htdocs/wsb4850525601/form_test.php on line 34
Line 34: $subject = '$_POST[ 'habbo' ] - Job Application';
Can someone just look this over and tell me if it will work and how to fix it?
BTW, I'm sure the $to variable is wrong
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Job Application</title>
<style type="text/css">
<!--
body {
font-family: tahoma;
font-size: 11px;
font-weight: bold;
-->
</style>
</head>
<body>
<?php
if( ! $_POST[ 'submit' ] ) {
echo '<form action="" method="post">
Real Name:<br /><input type="text" name="name" /><br />
Age:<br /><input type="text" name="age" /><br />
Habbo Name:<br /><input type="text" name="habbo" /><br />
Job Applying For:<br /><input type="text" name="job" /><br />
Experience:<br /><textarea rows="2" cols="20" name="experience"></textarea><br />
Message:<br /><textarea rows="2" cols="20" name="message"></textarea><br />
<input type="submit" name="button" id="button" value="Submit" />
</form>';
} else {
$headers .= 'To: Me <[email protected]>' . "\r\n";
$headers .= 'From: <[email protected]>' . "\r\n";
$subject = '$_POST[ 'habbo' ] - Job Application';
$to = $_POST[ 'email' ];
$message = $_POST[ 'name' ] <br /> $_POST[ 'age' ] <br /> $_POST[ 'habbo' ] <br /> $_POST[ 'job' ] <br /> $_POST[ 'experience' ] <br /> $_POST[ 'message' ];
mail($to, $subject, $message, $headers);
}
?>
</body>
</html>
Thanks.
PS - I got the original script from another thread so credit to whoever posted it ;)
EDIT: tested it and it says this:
Parse error: syntax error, unexpected T_STRING in /homepages/34/d237406810/htdocs/wsb4850525601/form_test.php on line 34
Line 34: $subject = '$_POST[ 'habbo' ] - Job Application';