I wrote a script in PHP that works fine on its own, but when inserted into a document containing CSS does not work properly. I am a newb with the PHP programming, and what I am trying to do is create a simple register/login script. Once the user has successfully logged in I used the "header" command to redirect them to the rest of the site. I tested the code in the page with CSS and the header command did not work. I also placed the code in a blank document and upon successful login It did work. Does anyone know if the CSS is what is causing the problem here? Also, the code placed in the non-css document was copied directly from the css document, and the extensions for both is .php.
xylude
3
Junior Poster
Recommended Answers
Jump to PostThe header function must be used before any output is printed, i.e before the opening HTML tag, make sure there is no HTML code or echo/print functions before the header one.
Jump to PostAre you adding the PHP code to the top of the HTML/CSS file or using an include function? Can you post the code here?
Jump to PostThere doesnt seem to be a problem with the code, but for the header function, try to use a relative link and not http://localhost:
header('Location:./portfolio.php');
On the page that it is not working is the PHP code on there or is it in a seperate file. …
Jump to PostHave a look at the source code through your browser to see if there are any errors hidden beneath tables/elements.
If there are not add something similar to the following to see if the SQL query is causing an issue:
if($login_check>0) { header('Location:./portfolio.php'); } else { …
All 13 Replies
Will Gresham
81
Master Poster
xylude
3
Junior Poster
Will Gresham
81
Master Poster
xylude
3
Junior Poster
Will Gresham
81
Master Poster
xylude
3
Junior Poster
Will Gresham
81
Master Poster
xylude
3
Junior Poster
Will Gresham
81
Master Poster
xylude
3
Junior Poster
xylude
3
Junior Poster
Will Gresham
81
Master Poster
xylude
3
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.