Jump to content

Problem with User Registration Form


kac001

Recommended Posts

I need help with this ASAP!!! I pretty sure my boss will fire me if I can not figure this out tonight... PLEASE HELP!  I am a graphic designer and not a programmer... PLEASE HELP ME!!!

 

 

My form will not display the echoed message ("Please fill in all required (*) feilds", "Maximum length for username is 25 characters", etc.) when I hit submit...

 

It wouldn't even show the variables when I tried to just have the form only echo the various strings... nothing appeared... the only way I could get the string values to appear was through a array like this:

 

  if(is_array($_POST)){
    echo '<pre>';
    print_r($_POST);
    echo '</pre>';
  }

 

^^This returned the data fine... but when I try to echo on particular string and not using the array, nothing appears... This is crucial as this is how the custom error messages are displayed...

 

Here is my PHP code:

 


<?php 

$submit = $_POST['submit'];

//form data

$username  = strip_tags($_POST['username']);
$password  = strip_tags($_POST['password']);
$passwordrepeat  = strip_tags($_POST['passwordrepeat']);
$email  = strip_tags($_POST['email']);
$emailrepeat  = strip_tags($_POST['emailrepeat']);
$career_status  = strip_tags($_POST['career_status']);
$name_title  = strip_tags($_POST['name_title']);
$first_name  = strip_tags($_POST['first_name']);
$middle_name  = strip_tags($_POST['middle_name']);
$last_name  = strip_tags($_POST['last_name']);
$suffix  = strip_tags($_POST['suffix']);
$current_address1  = strip_tags($_POST['current_address1']);
$current_address2  = strip_tags($_POST['current_address2']);
$current_city  = strip_tags($_POST['current_city']);
$current_state  = strip_tags($_POST['current_state']);
$current_zip  = strip_tags($_POST['current_zip']);
$phone_home  = strip_tags($_POST['phone_home']);
$phone_mobile  = strip_tags($_POST['phone_mobile']);
$preferred_contact  = strip_tags($_POST['preferred_contact']);
$school_name  = strip_tags($_POST['school_name']);
$school_city  = strip_tags($_POST['school_city']);
$school_state  = strip_tags($_POST['school_state']);
$school_gradYear  = strip_tags($_POST['school_gradYear']);
$med_school_debt  = strip_tags($_POST['med_school_debt']);
$monthly_debt_payment  = strip_tags($_POST['monthly_debt_payment']);
$credit_score  = strip_tags($_POST['credit_score']);
$marital_status  = strip_tags($_POST['marital_status']);
$current_employer_name  = strip_tags($_POST['current_employer_name']);
$current_employer_city  = strip_tags($_POST['current_employer_city']);
$current_employer_state  = strip_tags($_POST['current_employer_state']);
$current_position  = strip_tags($_POST['current_position']);
$current_specialty  = strip_tags($_POST['current_specialty']);
$current_employer_startDate_mm  = strip_tags($_POST['current_employer_startDate_mm']);
$current_employer_startDate_yyyy  = strip_tags($_POST['current_employer_startDate_yyyy']);
$changing_employer  = strip_tags($_POST['changing_employer']);
$current_employer_endDate_mm  = strip_tags($_POST['current_employer_endDate_mm']);
$current_employer_endDate_yyyy  = strip_tags($_POST['current_employer_endDate_yyyy']);
$future_employer_name  = strip_tags($_POST['future_employer_name']);
$future_employer_city  = strip_tags($_POST['future_employer_city']);
$future_employer_state  = strip_tags($_POST['future_employer_state']);
$future_position  = strip_tags($_POST['future_position']);
$future_specialty  = strip_tags($_POST['future_specialty']);
$future_employer_startDate_mm  = strip_tags($_POST['future_employer_startDate_mm']);
$future_employer_startDate_yyyy  = strip_tags($_POST['future_employer_startDate_yyyy']);
$destination_city  = strip_tags($_POST['destination_city']);
$destination_state  = strip_tags($_POST['destination_state']);
$move_date_mm  = strip_tags($_POST['move_date_mm']);
$move_date_yyyy  = strip_tags($_POST['move_date_yyyy']);
$prop_single_family  = strip_tags($_POST['prop_single_family']);
$prop_townhouse  = strip_tags($_POST['prop_townhouse']);
$prop_condo  = strip_tags($_POST['prop_condo']);
$prop_co_op  = strip_tags($_POST['prop_co_op']);
$prop_duplex  = strip_tags($_POST['prop_duplex']);
$prop_mobile  = strip_tags($_POST['prop_mobile']);
$prop_other  = strip_tags($_POST['prop_other']);
$num_bedrooms  = strip_tags($_POST['num_bedrooms']);
$num_bath  = strip_tags($_POST['num_bath']);
$price_low  = strip_tags($_POST['price_low']);
$price_high  = strip_tags($_POST['price_high']);
$prop_purpose  = strip_tags($_POST['prop_purpose']);
$need_realtor  = strip_tags($_POST['need_realtor']);
$need_lender  = strip_tags($_POST['need_lender']);
$need_refinance_NoCash  = strip_tags($_POST['need_refinance_NoCash']);
$need_refinance_TakeCash  = strip_tags($_POST['need_refinance_TakeCash']);
$need_home_equity  = strip_tags($_POST['need_home_equity']);
$need_commercial  = strip_tags($_POST['need_commercial']);
$need_practice  = strip_tags($_POST['need_practice']);
$mortgage_needs  = strip_tags($_POST['mortgage_needs']);
$most_important  = strip_tags($_POST['most_important']);
$keep_property_time  = strip_tags($_POST['keep_property_time']);
$keep_mortgage_time  = strip_tags($_POST['keep_mortgage_time']);
$program_foundHome_lowDown_NoPMI  = strip_tags($_POST['program_foundHome_lowDown_NoPMI']);
$program_foundHome_20down_bestRate  = strip_tags($_POST['program_foundHome_20down_bestRate']);
$program_foundHome_20down_specializedLender  = strip_tags($_POST['program_foundHome_20down_specializedLender']);
$program_preapproved_physLoan  = strip_tags($_POST['program_preapproved_physLoan']);
$program_preapproved_coventionalLoan  = strip_tags($_POST['program_preapproved_coventionalLoan']);
$program_lenderBailed  = strip_tags($_POST['program_lenderBailed']);
$program_poorCredit  = strip_tags($_POST['program_poorCredit']);
$referral_source  = strip_tags($_POST['referral_source']);
$registration_date = date("Y-m-d");


if ($submit)
{
   
   //check that required fields are completed
   if ($username&&$password&&$passwordrepeat&&$email&&$emailrepeat&&$career_status&&$first_name&&$last_name)
   {
      //encrypt password
      $password = md5($password);
      $passwordrepeat = md5($passwordrepeat);
      
      if ($password==$passwordrepeat)
      {
         //check character length of username and 
         if  (strlen($username)>25)
         {
            echo "Maximum length for username is 25 characters.";
         }
         else
         {
            
            //check password length
            if (strlen($password)>25||(strlen($password)<6))
            {
               echo "Password must be between 6 and 25 characters in length.";
            }
            else 
            {
               //register the user
               
               echo "Success!";
            
            }
         }
      }
      else
         echo "Your passwords do not match. Please re-enter and hit submit again.";
   
   }
   else
      echo "Please fill in all required (*) feilds.";
}

?>

 

 

Here is my form:

 

 

http://www.doctorbrownshoes.com/testPHP/registration.php

Link to comment
Share on other sites

Since your submit button's name attribute is empty, then you assign that empty string to $submit, the if($submit) conditional evaluates to FALSE. Give the submit button's name attribute a value and try it again.

 

P.S. You don't need strip_tags() until you're going to redisplay the data. You DO however need to sanitize any user supplied data (such as form input) before letting it anywhere near a database query, if that's what you're going to do with it.

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.