这里显示从数据库中单独的页当前用户的细节是我的index.php:如何在PHP
<?php
define('INCLUDE_CHECK',1);
require "config.php";
require "functions.php";
require "data.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Creating a Facebook-like Registration Form with jQuery</title>
<link rel="stylesheet" type="text/css" href="demo.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<div id="div-regForm">
<div class="form-title">Sign Up</div>
<div class="form-sub-title">It's free and anyone can join</div>
<form id="regForm" action="submit.php" method="post">
<table>
<tbody>
<tr>
<td><label for="fname">First Name:</label></td>
<td><div class="input-container"><input name="fname" id="fname" type="text" /></div></td>
</tr>
<tr>
<td><label for="lname">Last Name:</label></td>
<td><div class="input-container"><input name="lname" id="lname" type="text" /></div></td>
</tr>
<tr>
<td><label for="email">Your Email:</label></td>
<td><div class="input-container"><input name="email" id="email" type="text" /></div></td>
</tr>
<tr>
<tr>
<td><label for="pass">New Password:</label></td>
<td><div class="input-container"><input name="pass" id="pass" type="password" /></div></td>
</tr>
<tr>
<td><label for="pass">Phone Number:</label></td>
<td><div class="input-container"><input name="phone" id="phone" type="text" /></div></td>
</tr>
<td><label for="sex-select">I am:</label></td>
<td>
<div class="input-container">
<select name="sex_select" id="sex-select">
<option value="0">Select Sex:</option>
<option value="1">Female</option>
<option value="2">Male</option>
</select>
</div>
</td>
</tr>
<tr>
<td><label>Birthday:</label></td>
<td>
<div class="input-container">
<select name="month"><option value="0">Month:</option><?=generate_options(1,12)?></select>
<select name="day"><option value="0">Day:</option><?=generate_options(1,31)?></select>
<select name="year"><option value="0">Year:</option><?=generate_options(date('Y'),1900)?></select>
</div>
</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" class="greenButton" value="Sign Up" /><img id="loading" src="img/ajax-loader.gif" alt="working.." />
</td>
</tr>
</tbody>
</table>
</form>
<div id="error">
</div>
</div>
</body>
</html>
data.php:
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn)
{
die('Could not connect: ' . mysql_error());
}
$sql = 'SELECT fname, lname, email FROM crop';
mysql_select_db('crop');
$retval = mysql_query($sql, $conn);
if($result){ $sql = "SELECT fname, lname, email FROM crop where id='$id'"; $retval = mysql_query($sql); if(! $retval) { die('Could not get data: ' . mysql_error()); } while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { echo "First Name :{$row['fname']} <br> ". "Last Name : {$row['lname']} <br> ". "Email Address : {$row['email']} <br> ". "--------------------------------<br>"; } }
echo "Fetched data successfully\n";
mysql_close($conn);
?>
我创建使用PHP和jQuery登记表并使用一些功能。
现在我需要,注册后,当前的用户详细信息显示在单独的页面。
现在我得到了,没有什么显示,它只显示数据成功获取。
请帮我解决这个问题。谢谢。
实际上它很简单,注册后,你可以在最后插入的ID保存到会话(这是用户ID),然后从不同的文件,阅读会话获得该ID然后使用该ID到单独文件的选择查询 – Ghost 2014-10-09 05:04:02
@ Arif_suhail_123哇,我已经看到你在那篇文章上的讨论,其相当多的哈哈。无论如何,这就像你的答案一样,使用会话,但相反只是保存ID,然后,使用它来查询另一个PHP页面 – Ghost 2014-10-09 05:14:25
仍然我正在改变代码博士。 – user4119973 2014-10-10 06:04:53