Jump to content

Css In Php


mvsveena

Recommended Posts

I have a php file "menu.php" in which the form submits to itself "$_SERVER['PHP_SELF']".

menu.php <div class="content">	  <div id="imgpart">		  .......	  </div>	  <div class="header">  		........	  </div>			<div class="left">				.......			 </div>				  <div class="main">				 <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"> 		   <label> User id:         </label>		   <input type="text" name="userid"  value="" tabindex="8"> <br> <br>		 <label> Password:     </label>		   <input type="password" name="pwd" value="" tabindex="9"> <br> <br>		   <input type="submit" name="subbutton" value="Submit" size="32" tabindex="10"> 		 </form>					  	  </div>	 </div>

Note: The "class=header", "class=left", "class=main" all refers to styles in style sheet (.main, .left etc). I didn't have my <link rel=stylesheet> tag in "menu.php"I have another file "loginform.php" in which i included the file "menu.php" using the require() function.

loginform.php:<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > <html>  <head>    <title> Login form </title> 	  <link rel="stylesheet" type="text/css" href="style1.3.php" />  </head>  <body>   <?php 	$user=""; 	if(isset($_POST['subbutton'])) //check whether the user has clicked the submit button 	{ 	$user = login(); // call the function login() 	} 	else 	{  	require("menu.php");	} 	if($user!="") 	{ 		require("menu.php");	}    	function login() 	{ 	   	  $eid  = $_POST['userid']; 	  $pwd1 = $_POST['pwd'];   	   ............ 	  ............... 	 //the code goes on by checking whether the userid is exist in db, password match etc... </html>

Note: In the file "loginform.php" I have used the <link rel="stylesheet"> tag. Now, when I run the file my styles are not visible in the browser. It seems that it is not talking to the css file.1. Why my styles are not visible in the browser, what is the proper way to include a css file.2. Do I need to change my "menu.php" into "menu.html" and do I need to add my stylesheet in "menu.html"?3. If I change "menu.html", could I include "menu.html" in "loginform.php" using the require().4. Is my code is standard?Appreciate the help/comments on the above queries and code.Thanks,Veen

Link to comment
Share on other sites

The PHP code in your form tag isn't outputting anything (check the HTML source it produces, you'll see action=""), you need to use echo or print to output the text.Get the Firebug extension for Firefox and open your page there, with Firebug enabled click on the Net tab and look for any requests that show up in red (you may need to refresh after opening Firebug). It may not be able to find the stylesheet. You can also use Firebug to examine any element on the page and it will show you what styles are being applied and where they're coming from.

Link to comment
Share on other sites

Hi all,I have changed the following to make my styles visible in the browser.1. removed all the html tags from loginform.php and added all those tags in menu.php2. changed style1.3.php <link rel="stylesheet" type="text/css" href="style1.3.php"> to style1.3.css <link rel="stylesheet" type="text/css" href="style1.3.css> Now the styles are in effect.Thanks to all for your help.-Veen

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...