Jump to content

Error after Echo on Back Button


Jambuster

Recommended Posts

Hey, I made a register page and its all working great.

 

I want to have a "Back" button when the user submits the form if password1 & password2 do not match or username allready exists. But trying to put one in after the echo command isn't working for me. Can anyone help?

 

Heres the error I recieve: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/jamiew90/public_html/Staff/register.php on line 49

 

Heres line 49 & the surrounding lines incase needed, line 49 is the one beginning with echo:

//none were left blank!  We continue...   
if($password != $cpassword) {   

// the passwords are not the same!     
echo "<br><br><b>Passwords do not match</b> <p> <FORM><INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;;"> </FORM>";";   

}else{   

// the passwords are the same!  we continue...   

 

Is it possible to even add a back button after echo?

Thanks for the help

 

- Jamie :)

Link to comment
Share on other sites

If you look at the syntax highlight you will see that you have double quotes inside of double quotes. This is syntax basics, which I would suggest you to look up.

 

echo '<br><br><b>Passwords do not match</b> <p> <INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;">';

 

You do not need the form tags for an input tag to work. You only need the form tags if you want to pass POST or GET data to the page, in this case you are trying to do neither. But making the echo's quotes the single quotes this should display and work correctly.

 

As stated you should look into syntax and namely the quotes and how to properly use them to understand this.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.