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);
    ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥100 支付宝批量检测实名工具
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题