PDA

View Full Version : help me, this its easy 4 you.



camaleon
April 11th, 2005, 09:31 AM
hi guys!

well i dont know so much of php, but i have a code that send mail form the web. just that i want that this code when i send the email DON'T show a new page that say (( thanks. )) i want that when i push the button SEND just CLEAR all the textfield and send the message.

thanks!

code:
-----------------------------------------------------------
<?PHP
$to = "any@any.com";
$subject = "Webpage";
$headers = "From: my page";
$forward = 0;
$location = "hi (http://www.gbs-global.com)";
$date = date ("l, F jS, Y");
$time = date ("h:i A");



$msg = "new webpage message en on $date at $time.\n\n";

if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}

mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo "thanks.";
}

?>
-----------------------------------------------------

Dutchy
April 11th, 2005, 09:46 AM
Hi




<?PHP
$to = "any@any.com";
$subject = "Webpage";
$headers = "From: my page";
$location = "hi";
$date = date ("l, F jS, Y");
$time = date ("h:i A");



$msg = "new webpage message en on $date at $time.\n\n";

if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}

mail($to, $subject, $msg, $headers);

?>



this should just send the mail without opening a page with 'thanks in it'

hope it helps...
Dutchy

camaleon
April 11th, 2005, 10:49 AM
i have a lil problem Dutchy 'cos the form its on html and the button SEND go to mail.php.

I WANT THAT WHEN I PUSH SEND. SEND THE MESSAGE AND RELOAD MAIL.HTML

Cybernoid
April 11th, 2005, 03:05 PM
i have a lil problem Dutchy 'cos the form its on html and the button SEND go to mail.php.

I WANT THAT WHEN I PUSH SEND. SEND THE MESSAGE AND RELOAD MAIL.HTML

Then STOP SHOUTING AND ASK POLITELY.

I'm sure you can't help being stupid, but there's a variable named "$location" in your code. You change it to the URL of the page you want it to go. Like so:
$location="mail.html";

How hard was that?