Hello i am creating a small forum and having trouble with the user sign up form.

i have the start of a sign up form on the index page then that jumps to the sign up page with more info, e.g...

index.php

<form action="signup.php" method="post">
name:
<input type="text" name="name" >
email:
<input type="text" name="email" >
<input type="submit">
</form>

signup.php

<?php 
$name = $_POST['name'];
$email = $_POST['email'];
?>
<form action="signup.php" method="post">
name:
<input type="text" name="name" value="<?php echo $name ?>" >
email:
<input type="text" name="email" value="<?php echo $email ?>" >
confirm email:
<input type="text" name="email2" >
password:
<input type="password" name="pass" >
<input type="hidden" name="flag" value=1>
<input type="submit">
</form>
<?php 
if (isset($_POST['flag']))
{
$name = $_POST['name'];
if ($name == '')
{
  echo "<script>javascript: NoName();</script>"
}
}
?>

and so on.

how would i get past this error as name does hold some info it holds the <?php echo $name ?>

but when i try to do

if ($name == '<?php echo $name ?>')
{
    //do error
}
if ($name != '<?php echo $name ?>')
{
    //carry on as normal and check rest
}

nothing happens i get no errors... what can i use??

fixed it all i used was

if ($name == '' || $name == '<?php echo $firstname ?>')
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.