StevenOliver Posted August 5, 2020 Share Posted August 5, 2020 (edited) Okay, now you get to do what I've had to do a thousand times.... google your error message, click the first result and see which scenario applies to your script. Debugging goes like this: 1.) Error reporting (you now have that at the top of your page) 2.) Google your errors 3.) Fix your errors. p.s. I'm still bothered about your <form> tag which appears to have no action ... but I'm too lazy to read your code and see if you have a javascript form.submit() in there somewhere... p.s#2 ..and the line of code that reads: if(isset($_COOKIE["id"])) .... where is "id" anywhere on what you posted? I see a setcookie("user_id" ..... and obviously "id" is different than "user_id" so does that need fixin' ??? Edited August 5, 2020 by StevenOliver 1 Quote Link to comment https://forums.phpfreaks.com/topic/311281-set-cookies-php-login/page/2/#findComment-1580382 Share on other sites More sharing options...
mac_gyver Posted August 5, 2020 Share Posted August 5, 2020 1 hour ago, eddcaton said: Do you think this might influence the cookie setting? no. it will set php's error related setting so that php will help you find what's causing the problem by reporting and displaying all the errors it detects. Quote Link to comment https://forums.phpfreaks.com/topic/311281-set-cookies-php-login/page/2/#findComment-1580383 Share on other sites More sharing options...
mac_gyver Posted August 5, 2020 Share Posted August 5, 2020 21 minutes ago, StevenOliver said: your <form> tag which appears to have no action ... in html5, no action attribute at all means that the form submits to the same page. you can also set action='#' to submit to the same page, but an empty action attribute, action='', is not valid html5 markup (as of the last time i checked.) 1 Quote Link to comment https://forums.phpfreaks.com/topic/311281-set-cookies-php-login/page/2/#findComment-1580385 Share on other sites More sharing options...
eddcaton Posted August 5, 2020 Author Share Posted August 5, 2020 Thanks for all the help and assistance on this really annoying issue. I have now found the error in the code. When coding in Sublime everything looks fine and no issues. When i took a look at the file directly from Cpanel there was a single . before <?php which threw the whole lot off. I have removed the dot from the cpanel view and it works perfectly now. Quote Link to comment https://forums.phpfreaks.com/topic/311281-set-cookies-php-login/page/2/#findComment-1580386 Share on other sites More sharing options...
Barand Posted August 5, 2020 Share Posted August 5, 2020 1 hour ago, StevenOliver said: 2.) You have "include 'db_const.php';".... please make it like this: include('db_const.php'); Include is not function. ( )s are not required. Quote Link to comment https://forums.phpfreaks.com/topic/311281-set-cookies-php-login/page/2/#findComment-1580388 Share on other sites More sharing options...
StevenOliver Posted August 6, 2020 Share Posted August 6, 2020 Barand, thank you. It does look naked without the ( ) though... mac_gyver, sorry I didn't know that.They sure are coming up with newfangled things nowadays! Quote Link to comment https://forums.phpfreaks.com/topic/311281-set-cookies-php-login/page/2/#findComment-1580389 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.