Epicballzy Posted July 5, 2014 Share Posted July 5, 2014 I'm trying to learn php, and I've picked up a php/mysql member system type script, and I'm trying to put the login/sign-up forms into my own pages. The problem I'm having though is getting PHP and HTML to work in the same echo""; This is the like I'm getting the errors at. <form name="login" action='".$_SERVER['PHP_SELF']."' method="post" class="box login"> I've tried switching around the tags, from " to ' but that didn't work. Any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/289457-using-html-and-php-in-the-same-echo-tags/ Share on other sites More sharing options...
Ch0cu3r Posted July 5, 2014 Share Posted July 5, 2014 This is the like I'm getting the errors It would be helpful if you posted any error messages you are getting in full here along with the relevant code. Quote Link to comment https://forums.phpfreaks.com/topic/289457-using-html-and-php-in-the-same-echo-tags/#findComment-1483947 Share on other sites More sharing options...
fastsol Posted July 5, 2014 Share Posted July 5, 2014 This is probably more of what you're going after echo '<form name="login" action="'.$_SERVER['SCRIPT_NAME'].'" method="post" class="box login">'; Technically html attributes are supposed to have double quotes. The way you had it the action would have had single quotes. But if all you're doing is submitting the form to the same page it resides on, then just leave the action blank. Also do not use the $_SERVER['PHP_SELF'] cause it is a big security risk, the SCRIPT_NAME or blank like I already suggested. Quote Link to comment https://forums.phpfreaks.com/topic/289457-using-html-and-php-in-the-same-echo-tags/#findComment-1483949 Share on other sites More sharing options...
Epicballzy Posted July 5, 2014 Author Share Posted July 5, 2014 (edited) This is probably more of what you're going after echo '<form name="login" action="'.$_SERVER['SCRIPT_NAME'].'" method="post" class="box login">'; Technically html attributes are supposed to have double quotes. The way you had it the action would have had single quotes. But if all you're doing is submitting the form to the same page it resides on, then just leave the action blank. Also do not use the $_SERVER['PHP_SELF'] cause it is a big security risk, the SCRIPT_NAME or blank like I already suggested. I removed the $_SERVER['SCRIPT_NAME'] and it worked. Thanks you! Edited July 5, 2014 by Epicballzy Quote Link to comment https://forums.phpfreaks.com/topic/289457-using-html-and-php-in-the-same-echo-tags/#findComment-1483950 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.