I may be heading in the wrong direction completly, but I can't get the
PHP script to 'gather and post' the data that should be aquired from the javascript.
Also, I'm not entirely sure of what should be in 'hiddenfieldname' - is this just an ID for the data or should it refer to a different hidden field within the form?
Below is my code for both
HTML form and
PHP mailer script.
HTML :
<form action="../php/newreview_form.php" method="post" name="submit_review" class="review_form">
<form onsubmit="document.GetElementByID('hiddenfieldname').value = document.GetElementByID('resturant_name').innerHTML">
<input name="Submit" type="submit" value="Submit" />
</form>
<div id="resturant_name">Curry house 1</div>
PHP :
<?php
// Receiving variables
@$pfw_ip= $_SERVER['REMOTE_ADDR'];
@$res_name = addslashes($_POST['resturant_name']);
//Sending Email to form owner
$pfw_header = "From: $name\n"
. "Reply-To: $name\n";
$pfw_subject = "New curry test";
$pfw_email_to = "*MYEMAILHERE*";
$pfw_message = "Visitor's IP: $pfw_ip\n"
. "res_name: $resturant_name\n"
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header );
header("Location: Untitled-10.html");
?>
When you got a chance, I'd be so thankful for some guidence.
I also tried it like this : (thinking that the javascript line may need a name tag to enable the
PHP script to pick up the data. As you can guess, this didn't work.
HTML:
<form action="../php/newreview_form.php" method="post" name="submit_review" class="review_form">
<form name="resturant_name" onsubmit="document.GetElementByID('resturant_title').value = document.GetElementByID('resturant_name').innerHTML"/>
<input name="Submit" type="submit" value="Submit" />
</form>
<div id="resturant_name">Curry house 1</div>