Results 1 to 2 of 2

Thread: Access external CSS file from PHP file?

  1. #1
    Join Date
    Aug 2004

    Access external CSS file from PHP file?

    Hello everyone:

    I am working a project that display a form between header and footer section. I want to center the error message just above the form.

    I have three files header.php, footer.php and password.php. I use php include to include header and footer section.

    Within the header.php file, I accessed an external style sheet - global.css which have all the styles.

    I don't know what approach should I use to crate a style in global.css file so I can make the error message display right above the form after user click update password button.
    a) Should I add div elements in header.php file ?

    Code Segment in password.php file
    PHP Code:
      if($num == 1)
    $row mysql_fetch_array($resultMYSQL_NUM);

    $query "update friend set password=SHA('$newpd')
              where user_id=

    $result mysql_query($query);

    //user password being successfully updated
    if(mysql_affected_rows() == 1)
    '<h1 id="mainhead">Thank You!</h1>
            <p>Your password has been updated.</p>'

    '<h1 id="mainhead">System Error!</h1>
                  <p class="error">Your password could not be changed due to a system error.</p>'


    //display error message if there were no matching records found in db
    '<h1 id="mainhead">Error!</h1>
                  <p class="error">Your email address and password do not match those on file. Please
                     try again.</p>'

    Please give me some advises. Thanks!

    Link to the php file

    file structure image

  2. #2
    Join Date
    Feb 2006
    Salisbury UK
    I think it sometimes depends on the order of the php and form in your page code.

    Can you set up the page code to show the form code after the php codes with the error and Thank You messages?

    In one of my forms the php code is coded first and the last item is "else" followed by the form, so the browser processes all the previous instructions first, which are invalid when the page is first loaded and so the "else" becomes valid and the form shows.

    After the form is filled in and the submit button pressed, the page is processed again and one of the previous instructions to post the data and show the error message or Thank You message becomes valid and the message is displayed where the form was and the form is not shown because the last "else" is not reached because a previous instruction was valid. In the case of an error warning the back button must be used to see the form again.

    There is a separate board for PHP queries. I'm not an expert in PHP.
    Code downloaded to my PC will be deleted in due course.
    WIN7; IE9, Firefox, Opera, Chrome and Safari for Windows; screen resolution usually 1366*768.
    Also IE6 on W98 with 800*600 and IE8 on Vista 1440*900.

Similar Threads

  1. PHP include - root relative path?
    By web88js in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 05 Oct 2007, 12:59 AM
  2. Appending New XML To An XML File With PHP
    By Streakfury in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 27 Mar 2006, 03:21 PM
  3. PHP Include: If file not found, can i direct to a default file?
    By ukcoolat in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 04 Nov 2005, 10:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts