PDA

View Full Version : Please can some one help me with this request php code



Matt.
19-09-2005, 05:02 PM
I have made two pages for a request page , on the request page I have
<form name="form" id="form" method="post" action="LOCATION.php"><br>
question :<input name="title" type="text" /><br>
<br>
<br>
<select name="rate">
<option>5</option>
<option>4</option>
<option>3</option>
<option>2</option>
<option>1</option>
</select><br><br>
<textarea name="message" ></textarea>
<br><br>
<input type="submit" name="Submit" value="button text">

And on a page called "LOCATION.php" I have
<?phpif ($_SERVER['REQUEST_METHOD'] != 'GET'){
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message];
$email = "
Name: $name /n Email: $email /n Subject: $subject/n Message: $message /n
";
mail("my email address", $subject, $email);
Header("Location: thanks.html");
}
else
{
echo "Sorry your message could not be sent. Go back and try again!";
}
?>
Does anyone know what i'm doing wrong many thanks , Matty

splintercell!
19-09-2005, 05:07 PM
Try this:


<?phpif ($_SERVER['REQUEST_METHOD'] != 'GET'){
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$email = "
Name: $name /n Email: $email /n Subject: $subject/n Message: $message /n
";
mail("EMAIL", $subject, $email);
Header("Location: thanks.html");
}
else
{
echo "Sorry your message could not be sent. Go back and try again!";
}
?>
and also the bit that says EMAIL make it your email!

Matt.
19-09-2005, 05:10 PM
i did use my email i juts put that in so no 1 get my email address:)
that did not work i send 2 send a request and it now says
Parse error: parse error, unexpected '{' in /home2/habbteam/public_html/LOCATION.php on line 1

splintercell!
19-09-2005, 05:17 PM
<?php
if ($_SERVER['REQUEST_METHOD'] != 'GET'){
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message];
$email = "
Name: $name /n Email: $email /n Subject: $subject/n Message: $message /n
";
mail("my email address", $subject, $email);
Header("Location: thanks.html");
}
else
{
echo "Sorry your message could not be sent. Go back and try again!";
}
?>

Try that :s

Matt.
19-09-2005, 05:22 PM
it doesnt work:'(
it just says Parse error: parse error, unexpected $ in /home2/habbteam/public_html/LOCATION.php on line 17

splintercell!
19-09-2005, 05:25 PM
<?php
if ($_SERVER['REQUEST_METHOD'] != 'GET'){
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$info = "
Name: $name /n Email: $email /n Subject: $subject/n Message: $message /n
";
mail("my email address", $subject, $info);
Header("Location: thanks.html");
}
else
{
echo "Sorry your message could not be sent. Go back and try again!";
}
?>

Matt.
19-09-2005, 05:31 PM
i tryed 2 send a request and then it says The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
it cant find the page:S+it does not send it:(

мϊкэ
19-09-2005, 06:14 PM
<?php
if(isset($_POST["send"])){
$name = $_POST["name"];
$email = $_POST["email"];
$subject = $_POST["subject"];
$msg = $_POST["msg"];
$receiver = "EMAIL";
if(empty($name)){
echo("-There was no name!<br />");
}
if(empty($email)){
echo("-The email was empty or invalid!<br />");
}
if(empty($subject)){
echo("-There was no subject!<br />");
}
if(empty($msg)){
echo("-There was no message!<br />");
}
if(!empty($name) && !empty($email) && !empty($subject) &&
!empty($msg)){
$headers = "MIME-Version: 1.0";
$headers .= "Content-type: text/html; charset=iso-8859-1";
$headers .= "From: ".$email."";

$messageproper =

"------------------------- Email -------------------------\n\n" .
"Name: $name\n" .
"Email: $email\n" .
"Message: $msg\n" .

"\n------------------------------------------------------------\n" ;

mail("$receiver", $subject, $messageproper, "From: \"$name\"
<$email>\nReply-To: \"$name\" <$email>\nX-Mailer: chfeedback.php 2.02"
);
echo( "Thank you <b>$name</b>, your email was sent!" );
}
}
?>
</font>
<form method='post'>
Name:<br />
<input type='text' name='name' size='35'><br />
E-mail:<br />
<input type='text' name='email' size='35'><br />
Subject:<br />
<input type='text' name='subject' size='35'><br />
Message:<br />
<textarea name='msg' rows='8' cols='42'></textarea><br />
<input type='submit' name='send' value='Send Email'> <input type='reset' value='Reset'>
</form>


I use something like that.. just customize it how you need it

Matt.
19-09-2005, 06:20 PM
cool:)Thanks for that, it works:)+rep:)

Want to hide these adverts? Register an account for free!