Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP form submit > created script? 2

Status
Not open for further replies.

tekquest

Vendor
Joined
Feb 1, 2003
Messages
224
Location
AU
All,

I need a PHP script on my site, that I can have data fields (e.g. name, address etc) and when they are done filling out the details, they click "submit" and I receive an email.

Does anyone have a pre-created script I can use?

Thanks for looking,


Luke
 
do u want to create a contact us form?

Known is handfull, Unknown is worldfull
 
that would do, but with a few extra fields... yes :-)


Luke
 
try this:

Code:
<?php
if( $name && $address) { // user submited informations
  $message=&quot;Name: &quot;.$name . &quot;\n&quot;;
  $message.=&quot;Address: &quot;.$address . &quot;\n&quot;;
  // any other items of your form place here as the row above (the dot is very important before the equal sign!)
  $headers=&quot;From: any_address@any_domain.com\n&quot;;
  $headers.=&quot;X-Priority: 2\n&quot;; // Message priority normal
  mail(&quot;youraddress@yourdomain.com&quot;,&quot;Subject&quot;,$message,$headers);
} ?>
<!-- Here comes your form -->
<HTML><BODY>
<FORM name=&quot;MyForm&quot; action=&quot;&quot; method=POST>
<TABLE width=100%>
<TR><TD>Name:</TD><TD><INPUT type=text name=&quot;name&quot;></TD></TR>
<TR><TD>Address:</TD><TD><INPUT type=text name=&quot;address&quot;></TD></TR>
<!-- any other fields will come here (then you just need to pass them also to the $message variable using .= operator in the above php script -->
</FORM></TABLE></HTML>
 
Thanks guys, I will get started on it!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top