Jump to content

Basic quotes problem


farad

Recommended Posts

Hello there. Well this problem maybe basic but is kind of annoying me. I havea solution to it which I wil lexplain.

 

I have created a .php document which has html codes as well. It is a form that provides validation, for arguments sake lets say it is a form that validates if a user has entered their username and password, if not it will produce an error.

 

The problem I am having is I have embedded the code inside the echo

"

code is here

";

Now I have looked at escape characters and tried afew things, yet it still produces the same error on the same line.

 

Example

 

echo

 

"

 

 

!!!!!!!<form action='book.php' method='post' onsubmit="return checkForm('flogin');">!!!!!!

The reset of the form is here .....

 

"";

echo

 

The area highlighted in exclamation marks is where the area occurs, due to the quotes.

 

 

Any suggestions.

 

 

Thanks.

Link to comment
Share on other sites

When using quotes of the same type that enclose the string, you must escape them with a backslash.

 

echo "This is a string with \"double-quotes\" and 'single-quotes' in it. Notice the \"double-quotes\" are escaped because \"double-quotes\" enclose the string.";

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.