Jump to content

help with tweaking my script


runnerjp

Recommended Posts

[b]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.[/b]

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

[code]*/

// ------------- 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;

?>[/code]
Link to comment
Share on other sites

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
Link to comment
Share on other sites

[!--quoteo(post=384996:date=Jun 17 2006, 10:25 AM:name=JP128)--][div class=\'quotetop\']QUOTE(JP128 @ Jun 17 2006, 10:25 AM) [snapback]384996[/snapback][/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
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.