Jump to content

sending 2 php forms with one click


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 = '[email protected]';

$subject = 'the subject';

$from = '[email protected]';

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

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.