I have an orderform.php script where my customers can submit orders and I get an email notification with their order details (no financial data is sent).
I get a lot of bogus orders with spam in it. So I detect the users IP address in the orderform and now I want to add a submit button to this HTML notification email that I send to myself so I can click on the submit button (in the email) and call another PHP script that will automatically add the IP address to my BlockIP table. Orderform.php checks early in the script for blocked IPs and tries to match it to the current user who is accessing the form and if it finds a match, it does not display the order form.
I know how to do all of the PHP coding to make this happen but the trouble I am having is setting up the correct structure to make this work - I'm trying to pass the IP address into the email body but that is not working. I'm trying to store the IP address in a hidden HTML component so that when I click on the email Submit button when I get the email, it calls the ACTION script Test.php and I try to grab the value by referencing $frm_hidden_ip. But it's not working, inside the email when I build it in the orderform.php, it gets mailed but the value is empty when it shows up in my inbox.
I can't figure out why this is happening...thanks for any help...
Here is orderform.php
PHP Code:
[left]$php_ip_address = getenv(REMOTE_ADDR);
$php_To = "me@myisp.com";
$php_Headers = "From: me@myisp.com\nReturn-Path: me@myisp.com\nContent-Type: text/html;";
$php_Subject = "Order Test";
$php_Message = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">'.
'<HTML>'.
'<HEAD>'.
'<TITLE>Order Test</TITLE>'.
'</HEAD>'.
'<BODY>'.
'<FORM NAME="test_form" ACTION="http://www.mysite.com/Test.php" METHOD="post">'.
'<INPUT TYPE="hidden" NAME="frm_hidden_ip" VALUE="<?php echo $php_ip_address?>">'.
'<BR>'.
'<INPUT TYPE="submit" NAME="Submit">'.
'</BODY>'.
'</FORM>'.
'</HTML>';
mail($php_To, $php_Subject, $php_Message, $php_Headers);
[/left]
Here is Test.php which is called from orderform.php
PHP Code:
[left]<?php
$ip = $frm_hidden_ip; // grab the hidden HTML component's VALUE data
print "IP Address is: $ip";
?>
[/left]