Jump to content

[SOLVED] Is it possible to send data to a email aswellas some another page from a form??


naveenbj

Recommended Posts

Hello

How are you all??

 

I have a small php enabled form and i want this form to send the info(whtever the user entered)in my mail and as well as in the next page .

 

Here is the Link for my form>>http://ice.host-care.com/~com/n/form.html

 

here im able to show the info. in next page but not in my email.

So if anyone can help me it will be highly appriciated.:)

 

Thanks!!

Nj

 

 

 

So if I understand you correctly you can show data in the page, but your email script is not working... right??

 

If this is the case please post your email script code. Otherwise please clarify.

 

Thanks,

 

Nate

Hello

 

yaa you got the right point but i for the email point im not able to find out the script .

i mean which script is correct to send a mail with info.and that should be work for both(mail and data displaying).

Anyways which script you want to see??

 

 

 

ok thanks :)

here is the code for form.html.

 

<html>
<head>
<title>Form</title>
</head>
<body>
<p><FONT FACE="Verdana, Arial, Helvetica, sans-serif, Trebuchet MS" SIZE="5" COLOR="#FF9999">
<B>This is a simple example of Data Displaying from a form </B>
</FONT></p><form method="post" action="welcome.php"> 
<P><br> <BR></P><TABLE WIDTH="40%" BORDER="0" CELLSPACING="2" CELLPADDING="1" ALIGN="CENTER" BGCOLOR="#99CCCC"><TR>
      <TD WIDTH="121">
<P ALIGN="LEFT"><B><I><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000">First 
Name :-</FONT></I></B></P></TD>
      <TD WIDTH="487">
<P><B><I>
<INPUT NAME ="name" TYPE="text" ><br />
</I></B></P></TD></TR><TR>
      <TD WIDTH="121">
<P><B><I>
<FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000">
Last Name :-</FONT></I></B></P></TD>
      <TD WIDTH="487">
<P><B><I>
<FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000"><INPUT NAME ="lastname" TYPE="text" onkeypress="return handleEnter(this, event)"></FONT></I></B></P></TD></TR><TR>
      <TD WIDTH="121" HEIGHT="27">
<P><B><I><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000">Email 
: -</FONT></I></B></P></TD>
      <TD WIDTH="487" HEIGHT="27">
<P><B><I>
<FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000">
<INPUT NAME ="email" TYPE="text"></FONT></I></B></P></TD>
</TR><TR>
      <TD WIDTH="121" HEIGHT="2">
<P><B><I><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000">Age:-</FONT></I></B></P></TD>
      <TD WIDTH="487" HEIGHT="2">
<P><B><I>
<FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000">
<INPUT NAME ="age" TYPE="text">
</FONT></I></B></P></TD></TR>
<TR>
      <TD WIDTH="121">
<P><B><I><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000">
Gender:-</FONT></I></B></P></TD>
      <TD WIDTH="487">
<P><B><I>
<FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000"> 
<INPUT TYPE="radio" NAME="radiobutton" VALUE="male" onkeypress="return handleEnter(this, event)">
Male <INPUT TYPE="radio" NAME="radiobutton" VALUE="female" onkeypress="return handleEnter(this, event)">Female</FONT></I></B></P></TD></TR>
<TR>
      <TD WIDTH="121">
<P><B><I><FONT COLOR="#FF0000">Address:-</FONT></I></B></P></TD>
      <TD WIDTH="487">
<P><B><TEXTAREA NAME="address"></TEXTAREA></B></P></TD>
</TR><TR>
      <TD WIDTH="121"><B><I><FONT COLOR="#FF0000">Phone:-</FONT></I></B></TD>
      <TD WIDTH="487"><B><I><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000"> 
        <INPUT NAME ="phone" TYPE="text"></FONT></I></B></TD></TR>
<TR>
      <TD WIDTH="121"><B><I><FONT COLOR="#FF0000">Mobile:-</FONT></I></B></TD>
      <TD WIDTH="487"><B><I><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000"> 
        <INPUT NAME ="mobile" TYPE="text"></FONT></I></B></TD></TR>
<TR>
      <TD WIDTH="121"><B><I><FONT COLOR="#FF0000">Fax:-</FONT></I></B></TD>
      <TD WIDTH="487"><B><I><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000"> 
        <INPUT NAME ="fax" TYPE="text" onkeypress="return handleEnter(this, event)"></FONT></I></B></TD></TR>
<TR>
      <TD WIDTH="121"> </TD>
      <TD WIDTH="487"><B><I> <FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000"> 
        <INPUT NAME="submit" TYPE="submit">
<INPUT TYPE="reset" NAME="Submit" VALUE="reset">
</FONT></I></B></TD></TR></TABLE>
  <P> </P>
  <P>  </P>
</form>
</body>
</html>

Hello,

 

Thanks for reply!!

Here is the code for welcome.php

 

<html>
<head>
<title>Form</title>
</head>
<body>
<p><FONT FACE="Verdana, Arial, Helvetica, sans-serif, Trebuchet MS" SIZE="5" COLOR="#FF9999">
<B>This is a simple example of Data Displaying from a form </B>
</FONT></p><form method="post" action="welcome.php"> 
<P><br> <BR></P><TABLE WIDTH="40%" BORDER="0" CELLSPACING="2" CELLPADDING="1" ALIGN="CENTER" BGCOLOR="#99CCCC"><TR>
      <TD WIDTH="121">
<P ALIGN="LEFT"><B><I><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000">First 
Name :-</FONT></I></B></P></TD>
      <TD WIDTH="487">
<P><B><I>
<INPUT NAME ="name" TYPE="text" ><br />
</I></B></P></TD></TR><TR>
      <TD WIDTH="121">
<P><B><I>
<FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000">
Last Name :-</FONT></I></B></P></TD>
      <TD WIDTH="487">
<P><B><I>
<FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000"><INPUT NAME ="lastname" TYPE="text" onkeypress="return handleEnter(this, event)"></FONT></I></B></P></TD></TR><TR>
      <TD WIDTH="121" HEIGHT="27">
<P><B><I><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000">Email 
: -</FONT></I></B></P></TD>
      <TD WIDTH="487" HEIGHT="27">
<P><B><I>
<FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000">
<INPUT NAME ="email" TYPE="text"></FONT></I></B></P></TD>
</TR><TR>
      <TD WIDTH="121" HEIGHT="2">
<P><B><I><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000">Age:-</FONT></I></B></P></TD>
      <TD WIDTH="487" HEIGHT="2">
<P><B><I>
<FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000">
<INPUT NAME ="age" TYPE="text">
</FONT></I></B></P></TD></TR>
<TR>
      <TD WIDTH="121">
<P><B><I><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000">
Gender:-</FONT></I></B></P></TD>
      <TD WIDTH="487">
<P><B><I>
<FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000"> 
<INPUT TYPE="radio" NAME="radiobutton" VALUE="male" onkeypress="return handleEnter(this, event)">
Male <INPUT TYPE="radio" NAME="radiobutton" VALUE="female" onkeypress="return handleEnter(this, event)">Female</FONT></I></B></P></TD></TR>
<TR>
      <TD WIDTH="121">
<P><B><I><FONT COLOR="#FF0000">Address:-</FONT></I></B></P></TD>
      <TD WIDTH="487">
<P><B><TEXTAREA NAME="address"></TEXTAREA></B></P></TD>
</TR><TR>
      <TD WIDTH="121"><B><I><FONT COLOR="#FF0000">Phone:-</FONT></I></B></TD>
      <TD WIDTH="487"><B><I><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000"> 
        <INPUT NAME ="phone" TYPE="text"></FONT></I></B></TD></TR>
<TR>
      <TD WIDTH="121"><B><I><FONT COLOR="#FF0000">Mobile:-</FONT></I></B></TD>
      <TD WIDTH="487"><B><I><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000"> 
        <INPUT NAME ="mobile" TYPE="text"></FONT></I></B></TD></TR>
<TR>
      <TD WIDTH="121"><B><I><FONT COLOR="#FF0000">Fax:-</FONT></I></B></TD>
      <TD WIDTH="487"><B><I><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000"> 
        <INPUT NAME ="fax" TYPE="text" onkeypress="return handleEnter(this, event)"></FONT></I></B></TD></TR>
<TR>
      <TD WIDTH="121"> </TD>
      <TD WIDTH="487"><B><I> <FONT FACE="Arial, Helvetica, sans-serif" SIZE="2" COLOR="#FF0000"> 
        <INPUT NAME="submit" TYPE="submit">
<INPUT TYPE="reset" NAME="Submit" VALUE="reset">
</FONT></I></B></TD></TR></TABLE>
  <P> </P>
  <P>  </P>
</form>
</body>
</html>

-------------------

 

 

Regards,

Nj

 

I have a small php enabled form and i want this form to send the info(whtever the user entered)in my mail and as well as in the next page .

Don't get that.

 

But in welcome.php, you can just say:

 

mail($_POST['email'],"This is the subject","This is the message");

Not exactly.

Actually i want the intial info. to be mailed to my mailid and to be displayed in the next page.

 

<?php
// welcome.php
$to = "YOUR EMAIL ADDRESS";
$subject = "SUBJECT OF EMAIL";
$content = "WHAT THE BODY OF THE EMAIL SHOULD SAY";

mail($to, $subject, $content);
?>

Uh you just put whatever you want in $content. It's like the body of the email. I'm guessing you want all the $_POST information there, so put those in.

 

BTW you have to use "\r\n" to break a line in an email message. ;)

Thanks for reply!!

You mean to say like this>>

 

$content = echo $_POST["name"] "\r\n";

          echo $_POST["lastname"] "\r\n";

 

 

Sry if im wrong but im new in so sm things are still not cleared.

It would be great if you can describe me in bit briefly:)

 

i hope you understand:)

 

Best Regards,

Nj

Hello,

Thanks for reply!!

 

As you wrote i tried but not able to get the output:(

 

Here is the code which i used

$to = "[email protected]";
$subject = "Form Info";
$content = $_POST['name'] . "\r\n" . $_POST['lastname'] ."\r\n" . $_POST['email'] . "\r\n" . $_POST['age'] ."\r\n" . $_POST['radiobutton'] . "\r\n" . $_POST['address'] ;

 

So is it wrong??

 

Regards,

Nj

You forgot the mail() function.

 

This do any good?

<?php
$to = "[email protected]";
$subject = "Form Info";
$content = $_POST['name'] . "\r\n" . $_POST['lastname'] ."\r\n" . $_POST['email'] . "\r\n" . $_POST['age'] ."\r\n" . $_POST['radiobutton'] . "\r\n" . $_POST['address'];
mail($to, $subject, $content);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.