[Php]如果HTML输入等于某事,我该怎么回应 [英] [Php] how do I echo someting if HTML input equals something
本文介绍了[Php]如果HTML输入等于某事,我该怎么回应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我想制作一个小代码。我开始但我不能完成。我在html中输入了一个输入,在html中输入了一个按钮。
我想制作php代码如果点击按钮并输入等于admin,回显你是管理员例如我该怎么做
我尝试过:
尝试
<?php
if($ _ GET ['button1']){tryy();}
function tryy()
{
if($ text ==admin){
echo你是管理员;
}
}
?>
解决方案
_GET ['button1']){tryy();}
function tryy()
{
if(
text ==admin){
echo你是管理员;
}
}
?>
你的问题根本没有任何意义。无论如何。试试这个
#index.html
#取自w3school。
<!DOCTYPE html>
< html>
< body>
< h2> HTML表单< / h2>
< form action =/ action_page.php>
名字:< br>
< input type =textname =firstnamevalue =Mickey>
< br>
姓氏:< br>
< input type =textname =lastnamevalue =Mouse>
< br>< br>
< input type =submitvalue =提交>
< / form>
< p>如果您点击提交按钮,表单数据将被发送到名为/action_page.php\".</p>
< / body>
< / html>
#action_page.php
< PHP
Hello i want to make a small code . I started but i cant finish . I made a input in html and 1 button in html too .
I want to make php code if button clicked and input equals admin , echo "You Are Admin" for example how can i do this
What I have tried:
Try
<?php
if($_GET['button1']){tryy();}
function tryy()
{
if($text == "admin") {
echo "You Are Admin";
}
}
?>
解决方案
_GET['button1']){tryy();}
function tryy()
{
if(
text == "admin") {
echo "You Are Admin";
}
}
?>
Your question does not make any sense at all. Any way. Try this
# index.html
# taken from w3school. <!DOCTYPE html> <html> <body> <h2>HTML Forms</h2> <form action="/action_page.php"> First name:<br> <input type="text" name="firstname" value="Mickey"> <br> Last name:<br> <input type="text" name="lastname" value="Mouse"> <br><br> <input type="submit" value="Submit"> </form> <p>If you click the "Submit" button, the form-data will be sent to a page called "/action_page.php".</p> </body> </html>
# action_page.php
<?php
这篇关于[Php]如果HTML输入等于某事,我该怎么回应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文