简体   繁体   中英

Echo form input in php

I've written these 2 simple php code, to test php with jQuery:

FILE aaa.php

<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
  <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
  <script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>
  <form action="bbb.php" method="POST">
    <p>Il tuo Nome: <input type="text" name="name" value="" /></p>
    <p>La tua et: <input type="text" name="age" value ="" /></p>
    <p><input type="submit"></p>
  </form>
</body>
</html>

FILE bbb.php

Ciao <?php echo htmlspecialchars($_POST['name']); ?>.
La tua eta e di <?php echo (int)$_POST['age']; ?> anni.

But it doesn't work, because I don't receive any variable on bbb.php.

Could someone explain why?

如果您在没有ajax表单提交的情况下使用jquery mobile,则需要在表单中使用data-ajax="false"。

<form action="post.php" method="POST" data-ajax="false">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM