-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= "xyz@yahoo.in, $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>

为什么我在第 34 行得到一个意外的 t_if?我尝试了所有方法,但到目前为止没有任何帮助

4

2 回答 2

2

就您的问题而言,您在;这里忘记了$output_form= falseFIX IT!

于 2013-01-07T20:51:17.870 回答
2

你错过了一个分号:

$output_form= false
于 2013-01-07T20:51:23.973 回答