Jump to content

Php form is not working properly


atlfan

Recommended Posts

Okay, the following php form is "somewhat" working. .I am not receiving all of the variables to my inbox. 

 

This is the current form that i'm working on.

 

http://www.rodriguezstudios.com/pcr/schedule.php

 

The following fields are the ones are not passing through.

 

The Drop Down Menu: am, pm, the all day

 

Video

 

Case Option:

 

Additional Requests: 

 

Firm Physical Address: 

 

Fax No: 

 

Here is the code

 <?php  
             
            function displayRequired($fieldName) { 
                echo " \".$fieldName\"is required.<br />n"; 
            } 
             
            function validateInput($data, $fieldName){ 
                global $errorCount; 
                if (empty($data)){ 
                    displayRequired($fieldName); 
                    ++$errorCount; 
                    $retval = ""; 
                } else { 
                    $retval = trim($data); 
                    $retval = stripslashes($retval); 
                } 
                return ($retval); 
            } 
             
            $Deposition = validateInput(safe($_POST['deposition']), "Deposition");
			$Time = validateInput(safe($_POST['time']), "Time");
			$Delivery = validateInput(safe($_POST['delivery']), "Delivery");
			$Witness = validateInput(safe($_POST['witness']), "Witness");
			$Location = validateInput(safe($_POST['location']), "Location");
			$Attorney = validateInput(safe($_POST['attorney']), "Attorney");
			$Name = validateInput(safe($_POST['name']), "First Name"); 
			$Firm = validateInput(safe($_POST['firm']), "Firm Name"); 
			$Phone = validateInput(safe($_POST['phone']), "Phone");
            $Email = validateInput(safe($_POST['email']), "Email"); 
           
			
            
             
             
            if ($errorCount>0){ 
                echo "Please re-enter the information below.<br />\n"; 
                redisplayForm($Deposition, $Time , $Ampm, $Timeday, $Delivery, $Video, $Co1, $Co2, $Witness, $Location, $Additional, $Attorney, $Name, $Firm, $Address, $Phone, $Fax, $Email); 
            } 
            else 
             
            {     
                $To = "service@rodriguezstudios.com"; 
                $Subject = "The test"; 
                $From = "Schedule a Deposition - Professional Court Reporters"; 
             
				 
				 $Message .= "Deposition Date:  " . $Deposition . "\n";
				 $Message .= "Time: " . $Time . $Ampm. $Timeday . "\n\n";
				 $Message .= "Transcript Delivery: " . $Delivery . "\n\n\n";
				 $Message .= "Video:  " . $Video . "\n\n\n\n";
				 $Message .= "Case Option: " . $Co1. "vs: " . $Co2 . "\n\n\n\n\n";
				 $Message .= "Witness: " . $Witness . "\n\n\n\n\n\n";
				 $Message .= "Location:  " . $Location . "\n\n\n\n\n\n\n";
				 $Message .= "Additional Requests: " . $Additional. "\n\n\n\n\n\n\n\n";
				 $Message .= "Attorney Name: " . $Attorney . "\n\n\n\n\n\n\n\n\n";
				 $Message .= "Your Name:  " . $Name . "\n\n\n\n\n\n\n\n\n\n";
				 $Message .= "Firm Name: " . $Firm. "\n\n\n\n\n\n\n\n\n\n\n";
				 $Message .= "Firm Physical Address: " . $Address . "\n\n\n\n\n\n\n\n\n\n\n\n";
				 $Message .= "Phone No:  " . $Phone . "\n\n\n\n\n\n\n\n\n\n\n\n\n";
				 $Message .= "Fax No: " . $Fax. "\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
				 $Message .= "Email: " . $Email . "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
				 
                $Headers = "From: ". $From . "<" . $To. ">\r\n";   
                $Headers .= "Reply-To: " . $Email . "\r\n";  
                $Headers .= "Return-path: ". $Email; 
                $result = mail($To, $Subject, $Message, $Headers); 
                if ($result) 
                    $resultMsg = "You message was sucessfully sent."; 
                    else 
                    $resultMsg = "There was a problem sending your message."; 
				
				/*insert anti spam fragement here */
				
             ?>
       <p style="line-height:200%; text-align:center; font-family:Verdana, Geneva, sans-serif; color:#000000">Your deposition has been scheduled<?php 
                        if(!empty($fieldName)) { 
                            echo " , {$fieldName}. {$resultMsg}"; 
                        } 
                         
                    echo "</p>"; 
                } 
                ?> 
     
            
         <?php 
               function redisplayForm($Deposition, $Time , $Ampm, $Timeday, $Delivery, $Video, $Co1, $Co2, $Witness, $Location, $Additional, $Attorney, $Name, $Firm, $Address, $Phone, $Fax, $Email){ 
             
            ?> 
            
            
            
             <form action="" method="POST">
     <fieldset class="first">
            <fieldset class="first">
    <p>
      <label class="labelone"for="deposition">*Deposition Date:</label>
      <input type="text" id="datepicker" name="deposition" value="<?php echo $Deposition; ?>" />
    </p>
    <p>
      <label for="*Time:" name="time">*Time: </label>
      <input type="text" name="time" value="<?php echo $Time; ?>">
      <select name="ampm" id="Ampm">
        <option value="am">A.M.</option>
        <option value="pm">P.M.</option>
      </select>
      <select name="timeday" id="Timeday">
        <option value="all">All Day</option>
        <option value="half">Half Day</option>
        <option value="hours">1-2 hrs</option>
      </select>
    </p>
    <p>
      <label for="*Transcript Delivery:" name="transcript"/>
      *Transcript Delivery:</label>
      <select>
        <option value="regular">Regular Delivery (10 day)</option>
        <option value="same">Same Day</option>
        <option value="1day">1 Day</option>
        <option value="2day">2 Day</option>
        <option value="3day">3 Day</option>
        <option value="4day">4 Day</option>
        <option value="5day">5 Day</option>
      </select>
    </p>
    <p>
      <label for="*Video" name="video">*Video:</label>
        <select name="video" id="video">
          <option value="yes">Yes</option>
          <option value="no">No</option>
        </select>
      </label>
    </p>
    <p>
      <label for ="caseoption">Case Option:</label>
      <input type="text" name="co1" value="<?php echo $Co1; ?>"/>
      vs.
      <input type="text" name="co2" value="<?php echo $Co2; ?>" />
    </p>
    <p>
      <label for ="witness">*Witness:</label>
      <input type="text" name="witness" value="<?php echo $Witness; ?>" />
    </p>
  </fieldset>
  <fieldset>
    <legend>LOCATION OF DEPOSITION, TELEPHONE NUMBER, AND NAME OF CONTACT PERSON:</legend>
    <p>
      <label for="location">*Location:</label>
      <textarea name="location" id="Location" value="<?php echo $Location; ?>"></textarea>
    </p>
    <p>
      <label for="additional">Addtional Requests (i.e. Realtime):</label>
      <input type="text" name="additional" value="<?php echo $Additional; ?>" />
    </p>
    <p>
      <label for ="attorney">*Attorney Name:</label>
      <input type="text" name="attorney" value="<?php echo $Attorney; ?>" />
    <p>
      <label for ="name">*Your Name:</label>
      <input type="text" name="name" value="<?php echo $Name; ?>" />
    </p>
    <label for ="firm">*Firm Name:</label>
    <input type="text" name="firm" value="<?php echo $Firm; ?>" />
    </p>
    <p>
      <label for ="firmaddress">Firm's Physical Address:</label>
      <input type="text" name="address" value="<?php echo $Address; ?>" />
    </p>
    <p>
      <label for ="phone">*Phone No:</label>
      <input type="text" name="phone" value="<?php echo $Phone; ?>"/>
    </p>
    <p>
      <label for ="fax">Fax No:</label>
      <input type="text" name="fax" value="<?php echo $Fax; ?>"/>
    </p>
    <p>
      <label for ="email">*Email:</label>
      <input type="text" name="email" value="<?php echo $Email; ?>" />
    </p>
  </fieldset>
  <fieldset>
    <input class="btn" name="submit" type="submit" value="Send Email"/>
    <input class="btn" name="reset" type="reset" value="Clear Form" />
  </fieldset>   
    </form>
     
		<?php 
            } 
            ?>


<?php 
function safe($string) 
	{ 
		$pattern = "/\r|\n|\%0a|\%0d|Content\-Type:|bcc:|to:|cc:/i"; 
		return preg_replace($pattern, '', $string); 
	}
?>

The extra pair of eyes would be greatly appreciated! 

Link to comment
Share on other sites

Elaborate more because this $_POST syntax validates the required fields

 

  1. $Deposition = validateInput(safe($_POST['deposition']), "Deposition");
  2. $Time = validateInput(safe($_POST['time']), "Time");

 

i don't want those other options that there are not working to be checked.

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.