PHP窗体在Internet Explorer中不起作用 [英] PHP form not working in Internet Explorer

查看:107
本文介绍了PHP窗体在Internet Explorer中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了这个联系表单,它在firefox和chrome中完美工作,但在Internet Explorer中它不允许你输入文本(点击表单字段不做任何事情)提交按钮的作品,但只发送一个空白的消息,因为没有文字可以被输入。另外,当你按提交它试图打开firefox页面mail.php,我只在本地测试我的电脑可以这是问题吗?



PHP是这样的:

 <?php 
$ name = $ _POST ['name'];
$ email = $ _POST ['email'];
$ phone = $ _POST ['phone'];
$ message = $ _POST ['message'];
$ formcontent =此消息已经从联系页面生成\\\
名称:$ name \\\
电话:$ phone \\\
电子邮件:$ email \\\
消息:$ message;
$ recipient =myemail@myemail.co.uk;
$ subject =查询来自联系页面;
$ mailheader =From:$ email \r\\\
;
mail($ recipient,$ subject,$ formcontent,$ mailheader)或者die(Error!);
header('Location:../contact2.html');
?>

HTML是:

 < form id =form1action =PHP / mail.phpmethod =post> 
< label>名称< span class =small>添加您的名字< / span>< / label>
< input type =textname =name>< br>
< label>电子邮件< span class =small>输入有效的电子邮件< / span>< / label>
< input type =textname =email>< br>
< label>电话< span class =small>添加电话号码< / span>< / label>
< input type =textname =phone>< br>

< br>
< br>

< label>讯息< span class =small>输入讯息< / span>< / label>
< textarea name =messagerows =6cols =25>
< / textarea>< br>
< button type =submitvalue =Sendstyle =margin-top:15px;>提交< / button>
< div class =spacer>< / div>
< / form>


解决方案

基于纯粹的形式,在Chrome,FireFox和IE8中输入文本。



带上你的html表单代码,并把它放在一个独立的文件HTML文件中并在IE中测试,看看你是否获得相同的行为。



测试一个HTML文件可以缩小问题的范围,只需检查浏览器是否删除其他变量,如PHP服务器或javascript。
$

- 如果您遇到同样的问题:这是一个独立于该PC的IE问题。



- 如果您没有得到相同的问题:它可能是您的PHP配置或JavaScript的问题。

 < form id =form1action =PHP / mail.phpmethod =post> 
< label>名称< span class =small>添加您的名字< / span>< / label> < input type =textname =name/>< br />
< label>电子邮件< span class =small>输入有效的电子邮件< / span>< / label> < input type =textname =email/>< br />
< label>电话< span class =small>添加电话号码< / span>< / label> < input type =textname =phone/>< br />
< br>
< br>
< label>讯息< span class =small>输入讯息< / span>< / label>
< textarea name =messagerows =6cols =25>
< / textarea>< br>
< button type =submitvalue =Sendstyle =margin-top:15px;>提交< / button>
< div class =spacer>< / div>
< / form>


I created this contact form, it works perfectly in firefox and chrome but in internet explorer it wont allow you to input text (clicking on the form fields does nothing) the submit button works but only sends a blank message because no text can be entered. Also when you press submit it tries to open mail.php in a firefox page, i am only testing locally on my pc could this be the issue?

PHP is this :

<?php
    $name = $_POST['name'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $message = $_POST['message'];
    $formcontent="This message has been generated from the Contact page \n Name: $name \n Phone: $phone \n Email: $email \n Message: $message";
    $recipient = "myemail@myemail.co.uk";
    $subject = "Enquiry From contact page";
    $mailheader = "From: $email \r\n";
    mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
    header('Location: ../contact2.html');
?>

HTML is:

<form id="form1" action="PHP/mail.php" method="post">
    <label>Name <span class="small">Add your name</span></label> 
    <input type="text" name="name"><br>
    <label>Email <span class="small">Enter a Valid Email</span></label> 
    <input type="text" name="email"><br>
    <label>Phone <span class="small">Add a Phone Number</span></label> 
    <input type="text" name="phone"><br>

    <br>
    <br>

    <label>Message <span class="small">Type Your Message</span></label> 
    <textarea name="message" rows="6" cols="25">
    </textarea><br>
    <button type="submit" value="Send" style="margin-top:15px;">Submit</button>
    <div class="spacer"></div>
</form>

解决方案

Based on purely on the form you have I was able to enter text in the form in Chrome, FireFox and IE8.

Take your html form code and place it in an independent file HTML file and test in IE to see if you get the same behavior.

Testing an HTML file will narrow the problem down to just checking the browser removing other variables like your PHP server or javascript.

-If you get the same issue: it is a IE issue independent to that PC.

-If you do not get the same issue: it may be a problem with your php configuration or javascript.

            <form id="form1" action="PHP/mail.php" method="post">
                <label>Name <span class="small">Add your name</span></label> <input type="text" name="name" /><br />
                <label>Email <span class="small">Enter a Valid Email</span></label> <input type="text" name="email" /><br />
                <label>Phone <span class="small">Add a Phone Number</span></label> <input type="text" name="phone" /><br />
                <br>
                <br>
                <label>Message <span class="small">Type Your Message</span></label> 
                <textarea name="message" rows="6" cols="25">
                </textarea><br>
                <button type="submit" value="Send" style="margin-top:15px;">Submit</button>
                <div class="spacer"></div>
            </form>

这篇关于PHP窗体在Internet Explorer中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆