Jump to content

PHP Form Validatign


uramagget

Recommended Posts

<?
include "top.txt";
// get posted data into local variables
$username = Trim(stripslashes($_POST['username'])); 
$email = Trim(stripslashes($_POST['email'])); 
$password = Trim(stripslashes($_POST['password'])); 
$subdomain = Trim(stripslashes($_POST['subdomain']));
$currenturl = Trim(stripslashes($_POST['currenturl']));

//Send to, and subject.
$emailto = "rindiny@pokerindin.com";
$subject = "PokeRindin Hosting";


// Check if filled in/empty
if (Trim($email)==""){
echo "You forgot to fill in your E-Mail";
}

elseif (Trim($username)==""){
echo "You forgot to fill in your Username";
}
elseif (Trim($password)==""){
echo "You forgot to fill in your Password";
}
elseif (Trim($subdomain)==""){
echo "You forgot to fill in your Subdomain";
}


// prepare email body text
$Body = "";
$Body .= "Username: ";
$Body .= $username;
$Body .= "\n";
$Body .= "Password: ";
$Body .= $password;
$Body .= "\n";
$Body .= "Sub-domain: ";
$Body .= $subdomain;
$Body .= "\n";
$Body .= "Current URL: ";
$Body .= $currenturl;
$Body .= "\n";

// send email 
$success = mail($emailto, $subject, $Body, "From: <$email>");

// redirect to success page 
if ($success){
  echo "Your application was sent to Rindiny, and is awaiting approval. Can you join our forum while you wait, please?";
}
else{
  echo "Eeek! the form couldn't go through right. Only one thing to do. Contact Rindiny(rindiny@pokerindin.com), or try the form again. D: ";
}
include "bottom.txt";
?>

 

 

I'm trying to write a form where it makes users require them to fill it in, though even with the if code, the form is submitted, so I can't find out why this doesn't work.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.