Quote:
Originally Posted by deepaks85
Hi Friends,
I have a simple HTML form and simple PHP code which sends the filled information at my email address. Now, I am trying to get Page URL and Page Title at my email while submitting a form alongwith the info filled by user.
Here is my HTML form:
-
<form action="emailus.php" method="POST" name="Email_Submit" class="divtext">
-
-
<table width="400" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111">
-
<tr>
-
<td width="47%" valign="top">First Name:</td>
-
<td width="53%" valign="top">
-
<input name="FirstName" type="text" id="Contact_FName" size="20"></td>
-
</tr>
-
<tr>
-
<td valign="top">Last Name: </div></td>
-
<td valign="top">
-
<input name="LastName" type="text" id="Contact_LName" size="20"></td>
-
</tr>
-
<tr>
-
<td valign="top">Your E-mail:</td>
-
<td valign="top">
-
<input name="Email" type="text" id="Contact_Email" size="20"></td>
-
</tr>
-
<tr>
-
<td valign="top">Your Question:</td>
-
<td valign="top">
-
<textarea name="Question" rows="5" id="Question" cols="20"></textarea></td>
-
</tr>
-
<tr>
-
<td valign="top"><input name="Submit" type="submit" value="Submit"></td></tr>
-
-
</form>
-
Here is the emailus.php code:
-
<?
-
$FirstName = $_POST['FirstName'];
-
$LastName = $_POST['LastName'];
-
$email = $_POST['Email'];
-
$question = $_POST['Question'];
-
-
$message="First Name: $FirstName \n
-
Last Name: $LastName \n
-
Email: $email \n
-
Your Question: $question \n ";
-
-
mail( "deepaks85@gmail.com", "Email Us Form Submission from", "Message: $message", "From: $email" );
-
header( "Location: http://www.mydomain.com/thanks.html");
-
?>
-
I will appreciate if anyone can help me on this...
Thanks
Deepak
Maybe i'm not sure what your asking but you can always tack on more info to where the question is for example:
-
-
-
$question = $_POST['Question'];
-
$question .= "\nThis could be the page title\n";
-
$question .= "URL: mysite.com/link/to/your/page";
-
-
Is that what your asking for?
Check out $_SERVER[] on php.net to get all sorts of info on the server and file/page.
Cheers,
Dan