Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP表单标记难度_Php - Fatal编程技术网

PHP表单标记难度

PHP表单标记难度,php,Php,我想制作一个用PHP和CSS编写的申请表,我的问题是:在标签中,我设置了一个提交按钮,在将我的名字写入文本栏时,我在我的网页左上角得到了一句话“我输入的名字是:”。我不希望这句话出现在我的页面顶部。我想把这句话放在我输入姓名的文本框下面。让这个句子出现在我的网页顶部意味着一个设计糟糕的网页页面,但我不知道如何让这个句子出现在我希望它出现的地方。好的,当我去掉程序中的所有其他代码(如CSS代码等)并只保留标记本身(连同“我输入的名称是:”)时,我输入名称Gavin,得到的是“我输入的名称是:Gav

我想制作一个用PHP和CSS编写的申请表,我的问题是:在标签中,我设置了一个提交按钮,在将我的名字写入文本栏时,我在我的网页左上角得到了一句话“我输入的名字是:”。我不希望这句话出现在我的页面顶部。我想把这句话放在我输入姓名的文本框下面。让这个句子出现在我的网页顶部意味着一个设计糟糕的网页页面,但我不知道如何让这个句子出现在我希望它出现的地方。好的,当我去掉程序中的所有其他代码(如CSS代码等)并只保留标记本身(连同“我输入的名称是:”)时,我输入名称Gavin,得到的是“我输入的名称是:Gavin”,这句话出现在文本框上方。这一立场似乎是默认的,没有什么可以做的。我说得对吗?有没有办法重新定位我的句子,使它出现在文本框下面。还有,一旦我输入姓名并点击提交,有没有办法让我的文本框消失

<?php
//brownuniversity.php
if (!empty($_POST['name'])) {
    echo "Hello, {$_POST["name"]}, and welcome.";
}
?>

<html>
<head>
  <title>Image</title>
<style>
p.pos_fixed {
  position: fixed;
  top: 30px;
  right: 50px;
  color: black;
}
h4 {
  text-decoration: underline;
}
</style>
</head>
<body>
<h4>Application Form</h4>
<img src="alphacentauri.jpg" alt="starcluster" width="200" height="200" /><br/><br/>
<p class="pos_fixed">
  <b>Brown University:</b>
  <br><br><br>
  <b>Department of Physics:</b>
</p>
<ul>
  <li>question1</li>
  <li>question2</li>
</ul>

The name that I have entered is:

<form action="brownuniversity.php" method="post">
  If you want to take part in this star-gazing project, enter your name:
  <input type="text"  name="name">
  <input type="submit">
</form>

形象
p、 位置固定{
位置:固定;
顶部:30px;
右:50px;
颜色:黑色;
}
h4{
文字装饰:下划线;
}
申请表


布朗大学:


物理系:

  • 问题1
  • 问题2
我输入的名称是: 如果你想参加这个观星项目,请输入你的姓名:
在我的网页的左上角

因为那就是你要放的地方。看一看:

...

if(!empty($_POST['name'])) {
    echo "Hello, {$_POST["name"]}, and welcome.";
}
echo <<<_END
<html>

...
。。。
如果(!空($_POST['name'])){
echo“你好,{$\u POST[“name”]},欢迎您。”;
}
回音
...

对于初学者,请整理代码

这很有希望奏效

<?php
//brownuniversity.php
if (!empty($_POST['name'])) {
    echo "Hello, {$_POST["name"]}, and welcome.";
}
?>

<html>
<head>
  <title>Image</title>
<style>
p.pos_fixed {
  position: fixed;
  top: 30px;
  right: 50px;
  color: black;
}
h4 {
  text-decoration: underline;
}
</style>
</head>
<body>
<h4>Application Form</h4>
<img src="alphacentauri.jpg" alt="starcluster" width="200" height="200" /><br/><br/>
<p class="pos_fixed">
  <b>Brown University:</b>
  <br><br><br>
  <b>Department of Physics:</b>
</p>
<ul>
  <li>question1</li>
  <li>question2</li>
</ul>

The name that I have entered is:
<?php
//brownuniversity.php
if (isset($_POST['name'])) {
    $_POST["name"];
}
?>

<form action="brownuniversity.php" method="post">
  If you want to take part in this star-gazing project, enter your name:
  <input type="text"  name="name">
  <input type="submit">
</form>

形象
p、 位置固定{
位置:固定;
顶部:30px;
右:50px;
颜色:黑色;
}
h4{
文字装饰:下划线;
}
申请表


布朗大学:


物理系:

  • 问题1
  • 问题2
我输入的名称是: 如果你想参加这个观星项目,请输入你的姓名:
首先,请整理您的代码并查看如何正确格式化。第二,将回音移到输入下方。请解释您对OPI的回答。OPI复制并将您的代码粘贴到Textpad上,然后在浏览器上“运行”。不幸的是,我仍然在网页的左上角看到“你好,加文,欢迎”。但是谢谢你的建议。把前五行移到你希望它出现的位置。
<?php
//brownuniversity.php
if (!empty($_POST['name'])) {
    echo "Hello, {$_POST["name"]}, and welcome.";
}
?>

<html>
<head>
  <title>Image</title>
<style>
p.pos_fixed {
  position: fixed;
  top: 30px;
  right: 50px;
  color: black;
}
h4 {
  text-decoration: underline;
}
</style>
</head>
<body>
<h4>Application Form</h4>
<img src="alphacentauri.jpg" alt="starcluster" width="200" height="200" /><br/><br/>
<p class="pos_fixed">
  <b>Brown University:</b>
  <br><br><br>
  <b>Department of Physics:</b>
</p>
<ul>
  <li>question1</li>
  <li>question2</li>
</ul>

The name that I have entered is:
<?php
//brownuniversity.php
if (isset($_POST['name'])) {
    $_POST["name"];
}
?>

<form action="brownuniversity.php" method="post">
  If you want to take part in this star-gazing project, enter your name:
  <input type="text"  name="name">
  <input type="submit">
</form>