Click here to Skip to main content
14,695,609 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello!

I need help how to solve this error. Anyone is welcomed. I am a newbie in this php thing.
The error occurs in this line:
<?php echo $validate_msg; echo $checkuser; echo "<br/>"; echo $msg; ?>

Here are the codes with errors.

	// Validate e-mail address
	if(filter_var($submitemail, FILTER_VALIDATE_EMAIL))
	{
		if($numrows == 0)
		{
			$stmt->execute();
			$stmt->close();
		}
		else
		{
			$checkuser = "Username Or Email Already Used";
		}
	} 
	else
	{
		$validate_msg = "$submitemail is Not valid email address";
	} 

        if($conn->insert_id)
        {
            $msg = "<h3>Registered successfully.</h3>";
        }
        else
        {
			$msg = "Registration Failed";
		}
       
    }
		
?>

<body>

<div style="margin-top:5%" class="container">
  
    <div class="col-sm-4">
    </div>
    
  <div class="row">
    
    <div class="col-sm-4" style="background:#eeeeee;">
		<?php echo $validate_msg; echo $checkuser; echo "<br/>"; echo $msg; ?>
      <h2>Signup</h2>


What I have tried:

I can't figure out how to solve this. Thanks again for the usual help.
Posted
Updated 3-Aug-20 23:07pm
Comments
Sandeep Mewara 4-Aug-20 3:13am
   
Try Initialize variables to empty and see. Scope wise global.

<?php
// Initialize variables to empty.

$checkuser = '';
$validate_msg = '';

,,

,,
,,

1 solution

Quote:
I am a newbie in this php thing.
Help is at hand at PHP Tutorial[^] and PHP: PHP Manual - Manual[^].
   
Comments
JeffLiteral 4-Aug-20 23:24pm
   
Thanks a lot. It really helps..

Unfortunately, another error displayed. It says "Registration Failed" but when I checked on the phpmyadmin, the input details are reflected but the
Hide Copy Code
$id
returns 0. Maybe its the reason why it prompted "Registration Failed". Any help please.
Richard MacCutchan 5-Aug-20 3:11am
   
Sorry, but without the actual code we have no way of guessing what is happening.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900