Php 是否在同一页上获取要提交的表单?
好吧,我已经发布了这个,但仍然没有找到解决方案。我似乎不能让我的表格停留在同一页上,我基本上已经尝试了我能想到的一切Php 是否在同一页上获取要提交的表单?,php,html,forms,xampp,submission,Php,Html,Forms,Xampp,Submission,好吧,我已经发布了这个,但仍然没有找到解决方案。我似乎不能让我的表格停留在同一页上,我基本上已经尝试了我能想到的一切 <?php include("inc\incfiles\header.inc.php"); ?> <?php $reg = @$_POST['reg']; //declaring variables to prevent errors $fn = $ln = $un = $em = $em2 = $p
<?php include("inc\incfiles\header.inc.php"); ?>
<?php
$reg = @$_POST['reg'];
//declaring variables to prevent errors
$fn = $ln = $un = $em = $em2 = $pswd = $pswd2 = $d = $u_check = "";
/*$fn = ""; //First Name
$ln = ""; //Last Name
$un = ""; //Username
$em = ""; //Email
$em2 = ""; //Email 2
$pawd = ""; //:Password
$pawd2 = ""; //Password 2
$d = ""; //Sign up Date
$u_check = ""; //Check if username exists*/
//registration form
$fn = mysql_real_escape_string(@$_POST['fname']);
$ln = mysql_real_escape_string(@$_POST['lname']);
$un = mysql_real_escape_string(@$_POST['username']);
$em = mysql_real_escape_string(@$_POST['email']);
$em2 = mysql_real_escape_string(@$_POST['email2']);
$pswd = mysql_real_escape_string(@$_POST['password']);
$pswd2 = mysql_real_escape_string(@$_POST['password2']);
$d = date("Y-m-d"); //Year - Month - Day
if ($reg)
{
//check all of the fields have been filled in
if ($fn && $ln && $un && $em && $em2 && $pswd && $pswd2) {
}
else{
echo "please fill in all fields...";
}
}
?>
<table class="homepageTable">
<tr>
<td width="60%" valign="top">
<center><h2>Join the community today!</h2></center>
<center><img src="images/photo.png" width="500"></center>
<form>
</td>
<td width="40%" valign="top">
<h2>Get started below...</h2>
<form action="#" method="post">
<input type="text" size="25" name="firstname" placeholder="First Name" value="<?php echo $fn; ?>"/>
<input type="text" size="25" name="lastname" placeholder="Last Name" value="<?php echo $ln; ?>"/>
<input type="text" size="25" name="username" placeholder="Username" value="<?php echo $un; ?>"/>
<input type="text" size="25" name="email" placeholder="Email" value="<?php echo $em; ?>">
<input type="text" size="25" name="email2" placeholder="Repeat Email" value="<?php echo $em2; ?>"/>
<input type="password" size="32" name="password" placeholder="Password"/>
<input type="password" size="32" name="password2" placeholder="Repeat Password"/><br />
<input type="submit" name="reg" value="Sign Up!"/>
</form>
</td>
</tr>
</table>
今天就加入社区吧!
从下面开始。。。
尝试使用$\u服务器['PHP\u SELF']
请注意,在同一页面上有两个刻度,中间没有任何刻度。停留在同一页面上,我认为您的意思是您希望提交页面、刷新和发送数据。如果你是这个意思,那么你可以用它作为你的标签:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" >
您的问题是inc\incfiles\header.inc.php
<input name="q" type="text" size="60" placeholder="Search..."
不要发布重复的问题。如果您觉得以前的版本没有引起注意,您可以对其进行编辑,将其转储到列表的顶部。@MarcB即使我认为这两个问题的代码和错误是相同的!对不起,我是新来的。我不认为发布一个副本会有什么大不了的。只需编辑您之前的问题并添加您在此处添加的代码部分。那会把你的问题排在最前面。删除这个问题:)@MuhammedHedayet他们是一样的!我并不是想让他们不一样。正如你在第一句话中所看到的,我说我之前已经发布了这个。正如我在帖子中所说的,我已经尝试过了,但根本没有效果。无论如何谢谢你!当你这样做的时候会发生什么?我得到和以前一样的错误。它将你发送到哪个页面?它将我发送到一个全白色的页面,上面写着:找不到对象!在此服务器上找不到请求的URL。参考页面上的链接似乎错误或过时。请将错误告知该页的作者。如果您认为这是服务器错误,请联系网站管理员。错误404本地主机Apache/2.4.3(Win32)OpenSSL/1.0.1c PHP/5.4.7我也尝试过这个。但是运气不好。嗯,是的,这就是我的意思,对不起。但是我已经试过那个代码了,我仍然得到同样的错误。看看你的代码!还有一个附加标签!在此代码之后:立即加入社区代码>。这可能是问题所在!
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" >
<input name="q" type="text" size="60" placeholder="Search..."
<input name="q" type="text" size="60" placeholder="Search..." />
^^