我有以下用于创建网站的代码:
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org /TR/xhtml11 /DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
require_once("connect.php");
if(isset($_POST["firstName"]))
{
$fname = mysql_real_escape_string($_POST["firstName"]);
$lname = mysql_real_escape_string($_POST["lastName"]);
$email = mysql_real_escape_string($_POST["email"]);
$pass = mysql_real_escape_string($_POST["password"]);
$cpass = mysql_real_escape_string($_POST["cPassword"]);
$chars = "abcdefghijklmnopqrstuvwxyz0123456789";
$salt = "";
for($i = 0; $i < 30; $i++)
{
$rand = rand(0,35);
$salt = $salt . substr($chars, $rand, 1);
}
$hash = crypt($salt . $pass);
$query = "INSERT INTO users (salt, hash, email, fname, lname) VALUES ('$salt', '$hash', '$email', '$fname', '$lname')";
$result = mysql_query($query);
$cString = "";
for($i = 0; $i < 30; $i++)
{
$rand = rand(0, 35);
$cString = $cString . substr($chars, $rand, 1);
}
}
?>
<link rel="stylesheet" type="text/css" href="styles/common.css"/>
<link rel="stylesheet" type="text/css" href="styles/thanks.css"/>
</head>
<body>
<?php
echo $cString;
?>
为什么$cString
我的页面上没有出现的值?如果我回显它显示的字符串,但是当我回显变量时它不显示。为什么是这样?