Jump to content

Recommended Posts

hi

 

i was wondering how i could go about sending a copy of a form i have on my website to my email address?

 

the form goes straight to a client database when the user clicks "submit", but i would like to know what keyword the user found the page with and what their ipaddress is etc.

 

could i use the submit button to do a 2 in 1, and send the info to the database, then send a copy of the contents of the form plus the additional info (ipaddress etc) to my email address?

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/161056-sending-2-php-forms-with-one-click/
Share on other sites

Where does the form submit to?

 

Say the form action is do.php and currently inside of do.php there are queries being run to update your clients database. 

 

Simply add an email script in the do.php sending you the form data before the queries are run.

 

$to = 'user@domain.com';

$subject = 'the subject';

$from = 'email@domain.com';

$message = 'hello';

 

mail($to, $subject, $message, "From: $from");

THANKS! i added it to the mailform and i managed to get the ipaddress added to the email :D

 

how would i add the keyword the user entered and the page they filled the form out at? so far i have:

 

//index.php

 

<input type="hidden" name="IPAddress" value="<?php echo $_SERVER['REMOTE_ADDR'];?>">

    <input type="hidden" name="httpref" value="<?php echo $_GET['httpref'];?>" />

    <input type="hidden" name="kw" value="<?php echo $_GET['kw'];?>" />

    <input type="submit" id="btn_submit" name="submit" value="Get Your Quote"/>

 

//send_email.php

 

</tr>

<tr>

<td>Keyword</td>

<td>$kw</td>

</tr>

<tr>

    <td>Page</td>

<td>$httpref</td>

</tr>

<tr>

<td>IPAddress</td>

<td>$IPAddress</td>

</tr>

</table>

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.