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
https://forums.phpfreaks.com/topic/227691-basic-quotes-problem/
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.";

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.