download2014711 2017-02-16 01:36
浏览 61

关于Firefox问题的PHP表单(此地址未被理解)

-HTML code-

<html lang="en">
<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

</head>
<body>
<div class="container text-justify">
<h1>Fill this form pliz</h1>
<div class="form-group">
<form name="myform" method="post" action="formdb.php">
First name:<br> <input type="text" name="fname" placeholder=" First-name" required>
<br>
Second name:<br><input type="text" name="fname" placeholder=" Second-name" required>
<br>
Age:<br><input type="number" name="age" min="15" max="100" placeholder=" Age">
<br>
Email:<br><input type="email" name="email" placeholder=" E-mail">
<br><br>
Gender:<br>
<input type="radio" name="gender" value="Male"> Male<br>
<input type="radio" name="gender" value="Female"> Female <br>
<input type="radio" name="gender" value="Other"> Other <br>

Password:<br><input type="password" name="password" placeholder=" Password">
<br><br>
<input type="submit">
</form>
</div>
</div>
</body>
</html>

-PHP code-

<?php

echo "Values recieved"."<br>";

$fname=$lname=$age=$email=$sex=$pass="";

function test_input($data){
    $data=trim($data);
    $data=stripslashes($data);
    $data=htmlspecialchars($data);
    return $data;
}

if($_SERVER["REQUEST_METHOD"]=="POST")
{
    echo"bitch";
    $fname=test_input($_POST['fname']);
    $lname=test_input($_POST['lname']);
    $age=test_input($_POST['age']);
    $sex=test_input($_POST['gender']);
    $email=test_input($_POST['email']);
    $pass=test_input($_POST['password']);
}

echo "First name is ".$fname;

?>

When I submit the form, I get an error from Firefox saying that "This address wasn't understood". Both the PHP and HTML are located in the same directory. Is it an issue caused by Firefox or is there an error on my part?

  • 写回答

1条回答 默认 最新

  • doulouxun6756 2017-02-16 02:07
    关注

    Double Check: Name of Php File is it formdb.php, is it located in same folder as the form? if you run echo basename(__DIR__); is the form in same folder as formdb.php?

    You can Also Check for Errors: Put This In Your Html File

    <?PHP
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
    ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘