php 如何处理表单中的数据?

4jb9z9bj  于 2023-02-15  发布在  PHP
关注(0)|答案(1)|浏览(103)

这是我的代码(index-wamp.php):

`<!DOCTYPE html>
<html>
<head>
<title>Index of Commons || Sandwich Fun&reg;</title>
      
<!-- SANDWICH FUN (C) COURTESY OF MISTY CO, WITH PARTNERS
2023-02-04 20:48
--Revision--
--Revision--        -->
    
<!-- Det är psykologi. Frågan är bara hur psykologi riktigt tänker. Det verkar väldigt konstigt. -->
    
<meta name="viewport" content="width=device-width, initial-scale=1.0">
    
<link rel="stylesheet" href="smorgass.css">
<meta charset="UTF-8"> <!-- This is a game! -->
<meta name="author" content="Elise Knuuti of Misty Co">
    
<meta name="keywords" content="horses, game, horse-sim">
<meta name="description" content="A fully-featured horse game (sim) for ALL ages!">
      
<!-- It is forbidden to talk about Granberg in the company. -->
     
<!-- & Linda Jonasson & -->
     
<!-- The voices talk so creepy. They have destroyed my whole life. -->
     
<!-- Kommer att skicka ett hatbrev till Granberg -->
     
<!-- I'm going to code my game. I saw a picture of Magdalena Andersson. They are really creepy in Sweden. Ulf Kristersson is a perfect prime minister. -->
     
<!-- I have to explain my code. I have a few bugs. They are difficult. Josefine's mamma is banned. I have this one bug, problem with it. I don't understand the bug, it was text in the PHP book. :) Hm... What kind of bug can that be? Really, it's because it's a dangerous game! :D Now I get it! -->
     
</head>
<body>
    
<form action='register.php' method='POST'>
<fieldset>
<label for="username">Användarnamn:</label>
<input type='text' name='username'><br>
<label for="email">E-post:</label>
<input type='text' name='email'><br>

<label for="password">Lösenord:</label><input type="password" name="password"><br>
<input type='submit' value='LOGGA IN()!'>
</fieldset>

<?php

$a = $a + rand(1,10);

$b = $b + rand(1,10);

$answer = $a + $b;

?>

<?php echo "$a + $b ="; ?>
<input type='text' name='hausin'>
<input type='submit' name='captcha_reloaded' value='Sign in with CAPTCHA'>";

<!-- <?xml version="1.0" encoding="UTF-8"?>
<note>
<to>Computer HQ</to>
<from>Elise Knuuti</from>
<heading>Reminder</heading>
<body>We have high security in the company. I just finished a CAPTCHA (it's working!), and I need to fix the bugs. This is a painting computer. You should recall I want to create a phone.</body>
</note> -->
    
</body>
</html>`

现在,我想检查一下用户是否输入了正确的加法结果!我是在register.php页面上执行此操作吗?还是在同一个文件(index-wamp. php)中执行此操作?等等。
我想知道如何处理表单数据。

ajsxfq5m

ajsxfq5m1#

我想我解决了。
<form action='<?php if ($answer === $hausin) { echo "register.php"; } ?>' method='POST'>

相关问题