在单个页面上创建html和php页面 [英] Create html and php page on single page

查看:58
本文介绍了在单个页面上创建html和php页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天

我是PHP的初学者.我想用用户输入创建一个PHP网页.我检查了链接 http://www.w3schools.com/php/php_forms.asp [ ^ ]创建带有用户输入的html和php的表单. br/>
这是代码
//HTML FORM

Good day

I am a beginner in PHP. I want to create a PHP webpage with user input. I checked the link http://www.w3schools.com/php/php_forms.asp[^]on w3schools to create a form with html and php with user input.

Here is the code
//HTML FORM

<html>
 <body>

<form action="welcome.php" method="post">
 Name: <input type="text" name="fname" />
 Age: <input type="text" name="age" />
 <input type="submit" />
 </form>

</body>
 </html>



//PHP FORM(welcome.php)



//PHP FORM (welcome.php)

<html>
 <body>

Welcome <?php echo $_POST["fname"]; ?>!<br />
 You are <?php echo $_POST["age"]; ?> years old.

</body>
 </html>



如何修改不需要创建两个网页(PHP和HTML)的代码?所有代码都必须在单个页面上.我不想从html页面获取welcome.php.



How can I modify the code that I do not need to create two webpages(PHP and HTML)? All the code must be on a single page. I do not want to get the welcome.php form the html page.

推荐答案

_POST ["fname"]; ? < ; br / > 您是<? php 回声
_POST["fname"]; ?>!<br /> You are <?php echo


_POST [ "age"]; ? > 岁. < /body > < /html >
_POST["age"]; ?> years old. </body> </html>



如何修改不需要创建两个网页(PHP和HTML)的代码?所有代码都必须在单个页面上.我不想从html页面中获取welcome.php.



How can I modify the code that I do not need to create two webpages(PHP and HTML)? All the code must be on a single page. I do not want to get the welcome.php form the html page.


我得到的是您想要HTML页面中的welcome.php代码?
使您的表单像这样
What i get is that you want welcome.php code in HTML page??
Make your form like this
<form action="<?php


这篇关于在单个页面上创建html和php页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆