PHP语法错误

时间:2015-04-10 15:42:58

标签: php html

我有一个表单,并尝试使用PHP发送它,但当我访问该页面时,我看到了这个ID:

  

解析错误:语法错误,意外'。'在/home/n60web6/public_html/download/demo/Booking/index.php第74行

我尝试过所有事情,但似乎无法解决这个问题。请告诉我我做错了什么。

由于

<body>
        <?php
            //if "email" variable is filled out, send email
            if (isset($_REQUEST['email']))  {

                //Email information
                $admin_email = "hipevideos@gmail.com";
                $name = $_REQUEST['name'];
                $email = $_REQUEST['email'];
                $phone = $_REQUEST['phone'];
                $reason = $_REQUEST['reason'];
                $date = $_REQUEST['date'];
                $advice = $_REQUEST['advice'];
                $comment = $_REQUEST['comment'];

                //send email
                mail($admin_email, "$name", .$phone "$reason", .$date "$advice", .$comment "From:" . $email);

                //Email response
                echo "Thank you for contacting us! We will be intouch.";
            }

            //if "email" variable is not filled out, display the form
            else  {
        ?>

        <form action="" method="get">
            <fieldset>
                <legend>Personal Information</legend>
                <label for="name">Name</label><input type="text" name="name" id="name" required placeholder="Your name" pattern="[a-zA-Z]{3,}" title="Please enter more than three letters"><br>
                <label for="email">Email</label><input type="text" name="email" id="email" required placeholder="Your email" pattern="[a-zA-Z]{3,}@[a-zA-Z]{3,}[.]{1}[a-zA-Z]{2,}" title="Please enter a valid email address"><br>
                <label for="phone">Phone</label><input type="tel" name="phone" id="phone" required placeholder="Enter a phone number" pattern="[0-9]{1} [0-9]{3} [0-9]{3} [0-9]{4}" title="Please enter phone number in this format # ### ### ####"><br>
                <label for="reason">Service Needed</label><select name="reason" id="reason" required>
                <option value=""> </option>
                <option value="general">General</option>
                <option value="webDesign">Web Design</option>
                <option value="seo">SEO</option>
                <option value="ssm">SMM</option>
                </select>
            </fieldset>
            <br>
            <fieldset>
                <legend>Project Details</legend>
                <label for="date">Project Start date</label> <input type="date" name="date" id="date" min="04-10-2015">
                <p>Do you need design advice?</p>
                <label for="yes">Yes</label><input type="radio" name="advice" id="yes" value="yes">
                <label for="no">No</label><input type="radio" name="advice" id="no" value="no">
                <br><br>
                <p>What information should we know about your project?</p>
                <label for="comment" class="messageLabel"></label><textarea name="comment" id="comment" placeholder="Give us as much information." required title="Please give us some information about the project" class="message"></textarea>
                <br><br>
                <input type="image" src="SEND.png" class="send">
            </fieldset>
        </form>
        <?php
            }
        ?>
    </body>

1 个答案:

答案 0 :(得分:1)

这一行从头到尾都有错误的语法:

mail($admin_email, "$name", .$phone "$reason", .$date "$advice", .$comment "From:" . $email);