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

 

 

 

Link to comment
Share on other sites

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??

 

 

 

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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");

Link to comment
Share on other sites

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);
?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Hello,

Thanks for reply!!

 

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

 

Here is the code which i used

$to = "nobody@yahoo.com";
$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

Link to comment
Share on other sites

You forgot the mail() function.

 

This do any good?

<?php
$to = "nobody@yahoo.com";
$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);
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.