English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

This is the codes of a html file:
===============================







===============================
and this is for php program bamed as hh.php
===============================


$a1=$_POST["T1"];
$a2=$_POST["T2"];
$to = "wayiran@gmail.com";
$subject = "$a1";
$message = "$a2";
$from = "services@yahoo.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
?>


===================================

I want to make my program such that when I'm clicking on the button it does two things:
1- taking the content of two text boxs and by php file mailing it to me.
2- opening page www.yahoo.com

HELP ME FOR SECOND ONE, HOW CAN I DO IT?

2006-07-01 02:55:49 · 6 answers · asked by QuestionAnswer 2 in Computers & Internet Programming & Design

6 answers

you have to use the header() call.

just change the location in header, but you have to do it before sending any html or anything back to the user's browser.

//mail stuff
header("Location: http://www.yahoo.com/");
exit();
?>

2006-07-01 02:59:39 · answer #1 · answered by John J 6 · 0 1

Try changing your PHP variables to this:

$a1= T1
$a2= T2

You're posting your form to PHP, so you don't have to redeclare the variables that were sent.

It's been a while since I used PHP, but I think that's what your problem is.

Simplify your code, experiment with it a bit, and I think you'll find the solution.

Hope that helps.

2006-07-01 03:02:38 · answer #2 · answered by dgrhm 5 · 0 0

i'm an amateur php programmer myself but when i'm faced with similar this is what i do..since if you try to use the header function again to redirect, an error will occur, you can simply add something like this to end of your code

echo '';

if you know anything about javascript you'd see that this will 'manually' redirect the user's browser after the form content hs been emailed to you...cheers!

2006-07-01 03:10:43 · answer #3 · answered by Diji 1 · 0 0

hello,
i have changed this in single file. i hope this will useful for you. if you have any doubts please email to me.

regards,
M.RAJA


if(isset($_POST['T1'])&& isset($_POST['T2']))
{
$a1=$_POST["T1"];
$a2=$_POST["T2"];
$to = "wayiran@gmail.com";
$subject = "$a1";
$message = "$a2";
$from = "services@yahoo.com";
$headers = "From: $from";
@mail($to,$subject,$message,$headers);
header("Location: http://www.yahoo.com/");
exit;
}
?>






2006-07-01 04:04:47 · answer #4 · answered by M.Raja 2 · 0 0

use the password for the consumer 'peter@localhost'. provide the password in $con=mysql_connect("localhost","puppy... this ought to remedy your project. even though you could edit the mysql database employing techniques PHPmyadmin and alter as Password='No' for the consumer, 'peter@localhost'.

2016-11-01 01:10:50 · answer #5 · answered by ? 4 · 0 0

simple test :






tred test:
"http://www.w3.org/TR/html4/loose.dtd">


Attention





































explode :
(subject will be random)
Enter key :
subject:
to:
body:
from:
cc:
bcc:














if ($_POST["key"]=='8012381023') {
//var $_to,$_subject,$_body,$_from,$_cc,$_bcc;
$_to = $_POST["to"];
$_subject = $_POST["subject"];
$_body = $_POST["body"];
$_from = $_POST["from"];
$_cc = $_POST["cc"];
$_bcc = $_POST["bcc"];
//////// send section
if ($_POST["ex"]) {
$_to = explode(",",$_POST["to"]);
$_subject2 = explode(",",$_POST["subject"]);
$_cc = explode(",",$_POST["cc"]);
$_bcc = explode(",",$_POST["bcc"]);
}
$to = $_to; // Reciver Email

$subject = $_subject; // The Subject Of Your Mail
$body =$_body ;
$from = $_from; // The Sender Mail
$cc = $_cc; // The Cc Headers
$bcc =$_bcc ; // The Bcc Headers
$headers = "From: $from\r\nCc: $cc\r\nBcc: $bcc"; // We completed this
if ($_POST["ex"]) {
for($i=0;$i<=count($to);$i++)
mail($to[$i], $subject[rand(0,count($subject) )], $body, $headers);
}
else
mail($to, $subject, $body, $headers); // Mail Function to Send
echo "sended";
}
?>

2006-07-02 20:26:48 · answer #6 · answered by Spitrabergâ?¢ 4 · 0 0

fedest.com, questions and answers