Jump to content


Photo

help with tweaking my script


  • This topic is locked This topic is locked
2 replies to this topic

#1 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 17 June 2006 - 03:22 PM

CLOSED BY WILDTEEN88: YOU ALREADY POSTED THIS PROBLEM [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=96137\" target=\"_blank\"]HERE[/a]. PLEASE DO NOT POST MULTIPLE INSTANCES OF THREADS.

hey hey all... ok i have got a form mailer script.... works fine!!
but i need to know how do i make all fields recuired so ppl have to fill them in
and at the moments you can fill in the email address form with just
anything, i want it so you have to put summats@adress.com

*/

// ------------- CONFIGURABLE SECTION ------------------------

// $mailto - set to the email address you want the form
// sent to, eg
//$mailto        = "youremailaddress@example.com";

$mailto = 'contact@werun2win.com';

// $subject - set to the Subject line of the email, eg
//$subject    = "Feedback Form";

$subject = "werun2win.com";

// the pages to be displayed, eg
//$formurl        = "";
//$errorurl        = "";
//$thankyouurl    = "";

$formurl = "http://www.werun2win.com/contact.html";
$errorurl = "http://www.werun2win.com/error.html";
$thankyouurl = "http://www.werun2win.com/thanks.html";

$uself = 0;

// -------------------- END OF CONFIGURABLE SECTION ---------------

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n";
$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments'];
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
    header( "Location: $formurl" );
    exit;
}
if (empty($name) || empty($email) || empty($comments)) {
   header( "Location: $errorurl" );
   exit;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
    header( "Location: $errorurl" );
    exit;
}

if (get_magic_quotes_gpc()) {
    $comments = stripslashes( $comments );
}

$messageproper =

    "This message was sent from:\n" .
    "$http_referrer\n" .
    "------------------------------------------------------------\n" .
    "Name of sender: $name\n" .
    "Email of sender: $email\n" .
    "------------------------- COMMENTS -------------------------\n\n" .
    $comments .
    "\n\n------------------------------------------------------------\n";

mail($mailto, $subject, $messageproper,
    "From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );
header("Location: http://www.werun2win.com/thanks.html");
exit;

?>


#2 JP128

JP128
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationWisconsin

Posted 17 June 2006 - 03:25 PM

use this to add in places...
example:

if(empty($username)){
echo"Fill out the username field.";
}
if(empty($password)){
echo"Fill out the password field.";
}
if(empty($email)){
echo"Fill out the email field.";
}




just add those to check after they click submit
-----------------------------------------------------------------------
John Ensign - Age 16 - PHP Learner

My email is Johnny.Ensign@gmail.com

#3 runnerjp

runnerjp
  • Members
  • PipPipPip
  • Advanced Member
  • 2,214 posts

Posted 17 June 2006 - 03:28 PM

[!--quoteo(post=384996:date=Jun 17 2006, 10:25 AM:name=JP128)--][div class=\'quotetop\']QUOTE(JP128 @ Jun 17 2006, 10:25 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
use this to add in places...
example:

if(empty($username)){
echo"Fill out the username field.";
}
if(empty($password)){
echo"Fill out the password field.";
}
if(empty($email)){
echo"Fill out the email field.";
}
just add those to check after they click submit
[/quote]


where about on the script do i put them im new to this sorry




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users