-1

私はこのエラーがあります

Parse error: syntax error, unexpected '{' in receive/register.php on line 1

私の receive/register.php は

<?php
$_POST['username'] = $username;
$_POST['password1'] = $password;
$_POST['password2'] = $passwordagain;
$_POST['email'] = $email;

echo $username.'<br>'.$password.'<br>'.$passwordagain.'<br>'.$email;

if (!isset($username) || !isset($password) || !isset($passwordagain) || !isset($email))
{   /*
$_SESSION['regerrorid'] = '0';
$_SESSION['regerrormsg'] = 'Not all fields are completed';
header ('Location: ./'.$directory.'register');*/
echo'uhm';
}
?>

そして、情報を送信するのは

<?php
/* !!!!only if the code works
$_SESSION['regerrorid'] = $success;
$_SESSION['regerrormsg'] = $message;
*/
?>
<div class='registration-<?php echo $success; ?>'><?php echo $message; ?></div><br>
<form action="receive/register.php" method="POST">
  <span style='font-size:14px;font-family:"Lucida Console", Monaco, monospace'>Username:</span><input class='lolquired' type="text" name="username" /><br />
  <span style='font-size:14px;font-family:"Lucida Console", Monaco, monospace'>Password:</span><input class='lolquired' type="password" name="password1" /><br />
  <span style='margin-left:-56px;font-size:14px;font-family:"Lucida Console", Monaco, monospace'>Repeat Password:</span><input class='lolquired' type="password" name="password2" /><br />
  <span style='margin-left:24px;font-size:14px;font-family:"Lucida Console", Monaco, monospace'>Email:</span><input class='lolquired' type="email" name="email" /><br /><br />
  <input class="button" type="submit" value="Submit" />
</form><?php 
/* !!!!only if the code works
$_SESSION['regerrorid'] = '';
$_SESSION['regerrormsg'] = '';
*/
4

1 に答える 1

1

そうではありませんか:

$username = $_POST['username'];
$password = $_POST['password'];

等....

あなたのコードを使用すると、$username is undefined エラーが php 5.3.5 で発生しました

また、気づいた... $_SESSION を使用している場合は、追加する必要があります

session_start();

コードの先頭に

于 2011-07-16T17:22:42.857 に答える