Jump to content

drfill

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

drfill's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. sorry,  I should clarify and say that the form works perfectly until I add the extra code into it, and thats when things fall apart.
  2. ok here it is [code] <? $mailto = email@address.com; $subject = "Feedback" ; $formurl = "index.html" ; $errorurl = "application-error.html" ; $thankyouurl = "_application.html" ; $uself = 0; $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $name = $_POST['name'] ; $from = $_POST['from'] ; $location = $_POST['location'] ; $http_referrer = getenv( "HTTP_REFERER" );   if (!isset($_POST['from'])) { header( "Location: $formurl" ); exit ; } if (empty($name) || empty($from)) {   header( "Location: $errorurl" );   exit ; } function valid_email($from) {   // check an email address is possibly valid   if (ereg('^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$', $from))   return true;   else header( "Location: $errorurl" ); exit ; } if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $from ) ) { header( "Location: $errorurl" ); exit ; } if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "Enquiry from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "Name: $name\n" . "Email: $from\n" . "Location: $location\n" . "Interested in: $interested\n" . "\n\n------------------------------------------------------------\n" ; mail($mailto, $subject, $messageproper, "From: \"$from\" <$from>" . $headersep . "Return-Path: \"$name\" <$from>" . $headersep . "Reply-To: \"$from\" <$from>" . $headersep . "X-Mailer: chfeedback.php 2.07" ); header( "Location: $thankyouurl" ); exit ; ?> [/code] as you can see, the code is just sitting there. I've tried it in a few different places, but nought works
  3. Hello I am somewhat of a newbie when it comes to php, so I appreciate this question is probably very elementary. I currently have a form [code]$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $name = $_POST['name'] ; $from = $_POST['from'] ; $location = $_POST['location'] ; $interested = $_POST['interested'] ; $budget = $_POST['budget'] ; $distance = $_POST['distance'] ; $progress = $_POST['progress'] ; $comments = $_POST['comments'] ; $http_referrer = getenv( "HTTP_REFERER" );   if (!isset($_POST['from'])) { header( "Location: $formurl" ); exit ; } if (empty($name) || empty($from)) {   header( "Location: $errorurl" );   exit ; } if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $from ) ) { header( "Location: $errorurl" ); exit ; } if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "Enquiry from:\n" .[/code] etc that is a regular run of the mill 'send a email from form' script However, I get a lot of people entering wrong email addresses, e.g. using commas, not putting a suffix on, etc - so I'm wanting to be able to validate that the email address entered is in the correct format. So far I've tried several bits of code out, e.g. [code]function valid_email($from) {   // check an email address is possibly valid   if (ereg('^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$', $from))   return true;   else header( "Location: $errorurl" ); exit ; }[/code] but they all return one error or another. Unfortunately given my very basic knowledge of how php works I can't integrate the latter code with the above code. If anyone can give me any pointers on how to do this it would be greatly appreciated.
×
×
  • 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.