What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Contact Us Required

Contact Us Required
Author: Message:
Eddie
Veteran Member
*****


Posts: 2078
Reputation: 30
32 / Male / Flag
Joined: Oct 2005
Status: Away
O.P. Contact Us Required
Hello guys :) I'm still working on my website, i have done a contact us form, and im now trying to make it so all the items on the contact us form are required for succesful "postage". I have this code;
code:
// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}
How would i go about making it work with more than just one?

Whole Code If Required:
code:
<?php

// get posted data into local variables
$EmailFrom = Trim(stripslashes($_POST['EmailFrom']));
$EmailTo = "admin@haboz.net";
$Subject = "Contact Us";
$Name = Trim(stripslashes($_POST['HabboName']));
$Query = Trim(stripslashes($_POST['Query']));

// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}

// prepare email body text
$Body = "";
$Body .= "Habbo Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Query: ";
$Body .= $Query;
$Body .= "\n";

// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page
if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>


This post was edited on 01-25-2007 at 04:34 AM by Eddie.
01-25-2007 04:31 AM
Profile PM Web Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: Contact Us Required
Can't you check the other fields the same way you check $EmailFrom? If any one of them fails the validation, $validationOK will be set to false, and if $validationOK equals false, the script exits.

For example...

code:
// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if ($Name == "") $validationOK=false;
if ($Query == "") $validationOK=false;
if (!$validationOK) {
    print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
    exit;
}
:p

This post was edited on 01-25-2007 at 04:54 AM by WDZ.
01-25-2007 04:51 AM
Profile PM Web Find Quote Report
Eddie
Veteran Member
*****


Posts: 2078
Reputation: 30
32 / Male / Flag
Joined: Oct 2005
Status: Away
O.P. RE: Contact Us Required
Thanks WDZ :) Worked (Y)
01-25-2007 05:17 AM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On