farad Posted February 15, 2011 Share Posted February 15, 2011 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. Quote Link to comment Share on other sites More sharing options...
farad Posted February 15, 2011 Author Share Posted February 15, 2011 By the way I am trying to validate a drop down box, i.e. combobox. Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted February 15, 2011 Share Posted February 15, 2011 Please post all of the relevant code here. Use code tags and PHP tags where relevant. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 15, 2011 Share Posted February 15, 2011 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."; Quote Link to comment Share on other sites More sharing options...
farad Posted February 15, 2011 Author Share Posted February 15, 2011 I fixed the problem by putting the code outside my php. So it works. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.