2013-01-07 53 views
-5
<!DOCTYPE html> 
<html> 
<head> 
    <link href="aadab.css" rel="stylesheet" type="text/css"> 
    <link rel="icon" href="images/favicon.png"> 
</head> 
<body> 
<h2>REGISTRATION FORM</h2> 
<div id="form"> 


    <?php 
    if(isset($_POST['submit'])) 
     { 
      $name= stripslashes($_POST['name']); 
      $phone= stripslashes($_POST['phone']); 
      $email= stripslashes($_POST['email']); 
      $college= stripslashes($_POST['namecolg']); 
      $team= stripslashes($_POST['team']); 
      $im= stripslashes($_POST['im']); 
      $events= stripslashes($_POST['eventopts']); 
      $detail= stripslashes($_POST['detail']); 
      $subject= 'Registration for aadab 2013'; 
      $output_form= false 

      if ((empty($name)) || (empty($phone)) || (empty($email)) || (empty($college)) || (empty($events)) || (empty($detail))) 
       { 
        echo '<p id="fillall">It is necessary that you fill at least the required fields that are marked with a star</p>'; 
        $output_form= true; 
       } 
      else 
       { 
        $to= "[email protected], $email"; 
        $msg="Registration Detail: \n\n"."Name: $name \n"."Contact: $phone \n"."Email: $email \n"."College: $namecolg \n"."Team(if any): $team \n"."Instant message: $im \n"."Event(s) registered for: $team \n"."Details of the event(s): $team \n"; 

        mail($to, $subject, $msg) 
        echo 'Congratulations! You have successfully registered! You have been sent a confirmatory email.'; 
       } 
     } 
    else 
     {?> 
    <form action="<?php echo $_SERVER['PHP_SELF'] ?>" autocomplete="on"> 
     <table> 
      <tr> 
       <th><label for="name">Your fullname*</label></th> 
       <td><input type="text" id="name" name="name" value="<?php echo $name ?>" required></td> 
      </tr> 

      <tr> 
       <th><label for="phone">Your contact number*</label></th> 
       <td><input type="tel" id="phone" name="phone" value="<?php echo $phone ?>" required></td> 
      </tr> 

      <tr> 
       <th><label for="email">Your email-id*</label></th> 
       <td><input type="email" id="email" name="email" value="<?php echo $email ?>" required></td> 
      </tr> 

      <tr> 
       <th><label for="namecolg">Name of your college*</label></th> 
       <td><input type="text" id="namecolg" name="namecolg" value="<?php echo $college ?>" required></td> 
      </tr> 

      <tr> 
       <th><label for="team">The name of your team<br>(if registering for a team event)</label></th> 
       <td><input type="text" id="team" name="team" value="<?php echo $team ?>" ></td> 
      </tr> 

      <tr> 
       <th><label for="im">Bbm pin/iMessage id/Whatsapp<br>(if any, separate each id by a comma)</label></th> 
       <td><input type="text" id="im" name="im" value="<?php echo $im ?>" ></td> 
      </tr> 

      <tr> 
       <th>Event(s) you would like to register for*</th> 
       <td> 
       <input type="checkbox" name="eventopts" value="Literary"><span style="color: #DBDBDB;">Literary Event<br> 
       <input type="checkbox" name="eventopts" value="Art">Art Event<br> 
       <input type="checkbox" name="eventopts" value="Cultural">Cultural Event</span> 
       </td> 
      </tr> 

      <tr> 
       <th><label for="detail">Details of the event(s) you want to register for*</label></th> 
       <td><input type="text" id="detail" name="detail" value="<?php echo $detail ?>" required></td> 
      </tr> 

      <tr><td colspan="2" style="text-align: center; padding: 40px 0px 0px 0px;"><input type="submit" value="Register"></td</tr> 
     </table> 
    </form> 
    <?php } ?> 
    </div> 
    </body> 
    </html> 

爲什麼我得到一個意外的t_if第34行?我試過每一個yhing,但沒有任何幫助到目前爲止意外的t_if在線34

+1

你顯然沒有試圖「一切」,因爲如果你有你有固定的;) –

+0

謝謝@Kolink了合理的編輯回滾 – Madbreaks

回答

2

只要你的問題,你忘了;這裏$output_form= false修復它!

+0

謝謝你一噸!它的工作:D –

+0

@CodeName歡迎您,並確保upvote這個答案,讓您的問題得到解答。 – 2013-01-07 20:54:42

2

你缺少一個分號:

$output_form= false 
+0

是的,它工作謝謝你:) –