Jump to content

different layout in IE and safari


fypstudent

Recommended Posts

I create a web portal that allows the admin to add new staff information and if i enter in the existing staff ID, it will direct me to the next page, with the error message. however i faced problems when trying to display in two different browsers. as u can see....

 

this is the correct layout shown in safari.

http://www.flickr.com/photos/75437207@N00/2865205464/in/photostream/

 

and this is the incorrect shown in IE

http://www.flickr.com/photos/75437207@N00/2865205496/in/photostream/

 

notice the title bar is being dragged on the second image. HOw do i fix it?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style.css" rel="stylesheet" type="text/css">
<title>Staff Signage: Web Portal</title>

<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }
//-->
</script>
</head>

<body>
<form action="admin_create2.php" method="post" enctype="multipart/form-data">
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="4"><?php include("./include/headerAdmin.php"); ?></td>
  </tr>
  <tr>
    <td colspan="4" bgcolor="#FFFFFF" height="6"></td>
  </tr>
  <tr>
    <td width="5" valign="top" bgcolor="#FFFFFF"> </td>
    <td width="175" valign="top" bgcolor="#FFFFFF"><?php include("./include/leftBar.php");?></td>
    <td width="7" bgcolor="#FFFFFF"> </td>
    <td width="614" valign="top" bgcolor="#FFFFFF"><table width="605" height="344" align="center"cellspacing="0" bgcolor="#FAFAF5">
      <tr>
        <td width="612" height="20" align="left" bgcolor="#437AA6"><span class="contentHeader"> Create Lecturer/Staff Record</span></td>
      </tr>

      
      <tr>
        <td valign="top" bgcolor="#FAFAF5"><?php

// read the value of the hidden field & check whether it has been set
$submitted = isset($_POST['formSubmitted']);
$success = FALSE;

// check $submitted and blank fields
if ($submitted) {

// check if $_POST['name'] is empty and strip any slashes if not
if (!empty($_POST['staffid'])) {
	$staffid=stripslashes($_POST['staffid']);
} else {
	$staffid=NULL;
	echo '<p><span class="contentText"><font color="red"><b>You forgot to enter staffid!</font></span></p>';
}

// check if $_POST['username'] is empty and strip any slashes if not
if (!empty($_POST['name'])) {
	$name=stripslashes($_POST['name']);
} else {
	$name=NULL;
	echo '<p><span class="contentText"><font color="red">You forgot to enter name!</font></span></p>';
}

// check if $_POST['password'] is empty and strip any slashes if not
if (!empty($_POST['password'])) {
$password=stripslashes($_POST['password']);
} else {
	$password = NULL;
	echo '<p><span class="contentText"><font color="red">You forgot to enterpassword!</font></span></p>';
}

if (!empty($_POST['sex'])) {
$sex=stripslashes($_POST['sex']);
} else {
	$sex = NULL;
	echo '<p><span class="contentText"><font color="red">You forgot to enter gender!</font></span></p>';
}

// check if $_POST['sex'] is empty and strip any slashes if not
if (!empty($_POST['contactNo'])) {
	$contactNo=stripslashes($_POST['contactNo']);
} else {
	$contactNo=NULL;
	echo '<p><span class="contentText"><font color="red">You forgot to enter contact no!</font></span></p>';
}


// check if $_POST['email'] is empty and strip any slashes if not
if (!empty($_POST['email'])) {
	$email=stripslashes($_POST['email']);
} else {
	$email=NULL;
	echo '<p><span class="contentText"><font color="red">You forgot to enter email!</font></span></p>';
}

// check if $_POST[' '] is empty and strip any slashes if not
if (!empty($_POST['ext'])) {
	$ext=stripslashes($_POST['ext']);
} else {
	$ext=NULL;
	echo '<p><span class="contentText"><font color="red">You forgot to enter ext number!</font></span></p>';
}


// check if user entered interests in the checkboxes.
if (isset($_POST['position'])) {
	$position=$_POST['position'];
} else {
	$position = NULL;
	echo '<p><span class="contentText"><font color="red">You forgot to enter position!</font></span></p>';
}


// check if user entered some comments.
if (!empty($_POST['status'])) {
$status=stripslashes($_POST['status']);
} else {
	$status = NULL;
	echo '<p><span class="contentText"><font color="red">You forgot to enter status!</b></font></span></p>';
}



if ($name && $password && $sex && $contactNo && $email && $ext && $position  && $status) {

		require_once('staffSql.php');
					// connect to the mysql database server.
				mysql_select_db($dbname); 

				//assign the data passed from Flex to variables
				$staffid = mysql_real_escape_string($_POST["staffid"]);
				$name = mysql_real_escape_string($_POST["name"]);
				$password = mysql_real_escape_string($_POST["password"]);
				$sex = mysql_real_escape_string($_POST["sex"]);
				$contactNo = mysql_real_escape_string($_POST["contactNo"]);
				$email = mysql_real_escape_string($_POST["email"]);
				$ext = mysql_real_escape_string($_POST["ext"]);
				$position = mysql_real_escape_string($_POST["position"]);
				$photo = mysql_real_escape_string($_POST["photo"]);
				$status = mysql_real_escape_string($_POST["status"]);

				//Query the database to see if the given username/password combination is valid.
				$query = "INSERT INTO staff 				VALUES('$staffid','$name','$password','$sex','$contactNo','$email','$ext','$position','$photo','$status')";
				//$_SESSION['staffid'] = $staffid;
				$result = mysql_query($query);

		if ($result) {
	echo '<h3><font color="green"><br>Congratulations!</font></h3>';
	echo '<span class="contentText">Create staff sucessful!';
	echo '<p><span class="contentText">Click <a href = admin_main3.php> here</a> to go back to main</span></p>';



	echo '
				<p><table width="60%" border="0" cellspacing="0" class ="contentText">
		  <tr>
			<td width="10%"  bgcolor="#EAEAEA"><B>Staff ID:</b></td>
			<td width="20%"  bgcolor="#EAEAEA">'.$staffid.'</td>
			<td width="12%"  bgcolor="#EAEAEA"> </td>
			<td width="58%"  bgcolor="#EAEAEA"> </td>
		  </tr>
		  <tr>
			<td><B>Name:</b></td>
			<td colspan="3">'.$name.'</td>
		  </tr>
		  <tr>
			<td><B>Password:</b></td>
			<td>'.$password.'</td>
			<td> </td>
			<td> </td>
		  </tr>
		  <tr>
			<td><B>Gender:</b></td>
			<td>'.$sex.'</td>
			<td> </td>
			<td> </td>
		  </tr>
		  <tr>
			<td><B>Contact Number: </b></td>
			<td>'.$contactNo.'</td>
			<td> </td>
			<td> </td>
		  </tr>
			<tr>
			<td><B>Email: </b></td>
			<td>'.$email.'</td>
			<td> </td>
			<td> </td>
		  </tr>
		  <tr>
			<td><B>Extension Number:</b></td>
			<td>'.$ext.'</td>
			<td> </td>
			<td> </td>
		  </tr>
		  <tr>
			<td><B>Position:</b></td>
			<td>'.$position.'</td>
			<td> </td>
			<td> </td>
		  </tr>

		  <tr>
			<td><B>Status:</b></td>
			<td>'.$status.'</td>
			<td> </td>
			<td> </td>
		  </tr>
		</table>
		';
		} else {
			echo '<span class = "contentText">Staff already exist!. Please try again.</span>';
			echo '<p><span class="contentText">Click <a href = admin_create2.php> here</a> to go back to main</span></p>';
		}
	$success = TRUE;
}

}
?>
                <?php if($success==FALSE) { ?>
            <br />
                <span class="contentText"><B>Account Information</B></span>
          </p>
            <table width="590" cellspacing="0" class=".content">
              <tr>
                <td width="490"><table width="590" cellspacing="0" class=".content">
                    <tr>
                      <td width="104" class="contentText">Staff ID</td>
                      <td width="490"><label>
                        <input type="text" name="staffid" id="staffid" value="<?php if(isset($_POST['staffid'])) echo $staffid; ?>"/>
                        </label>
                          <br />                      </td>
                    </tr>
                    <tr>
                      <td class="contentText">Password</td>
                      <td><label>
                        <input type="password" name="password" id="password" />
                        </label>                      </td>
                    </tr>
                  </table>
                    <label></label></td>
              </tr>
            </table>
            <p class="contentText"><b>Staff Information</b></p>
          <table width="600" cellspacing="0">
              <tr>
                <td width="104" class="contentText">Name</td>
                <td width="490"><label>
                  <input name="name" type="text" id="name" size="40" value="<?php if(isset($_POST['name'])) echo $name; ?>" />
                  </label>                </td>
              </tr>
              <tr>
                <td class="contentText">Gender</td>
                <td class="contentText"><input type="radio" name="sex" value="M" <?php if(isset($_POST['sex']) && $sex=="M"); echo "checked" ?> />
                  <span class="contentText">Male</span>
                  <input type="radio" name="sex" value="F" <?php if(isset($_POST['sex']) && $sex=="F") echo "checked" ; ?> />
                  <span class="content">Female</span> </td>
              </tr>
              <tr>
                <td class="contentText">Contact Number</td>
                <td><input type="text" name="contactNo" id= "contact Number" size="20" maxlength="15" value="<?php if(isset($_POST['contactNo'])) echo $contactNo; ?>" />                </td>
              </tr>
              <tr>
                <td class="contentText">Email</td>
                <td><input type="text" name="email" id="email" value="<?php if(isset($_POST['email'])) echo $email; ?>"  />                </td>
              </tr>
              <tr>
                <td class="contentText">Ext Number</td>
                <td><input type="text" name="ext" id="ext"  value="<?php if(isset($_POST['ext'])) echo $ext; ?>"/>                </td>
              </tr>
              <tr>
                <td class="contentText">Position</td>
                <td><input type="text" name="position" id="position"  value="<?php if(isset($_POST['position'])) echo $position; ?>"/>                </td>
              </tr>
              <tr>
                <td class="contentText">Status</td>
                <td><input type="radio" name="status" value="In" <?php if(isset($_POST['status']) && $status=="In"); echo "checked" ?> />
                  <span class="contentText">In</span>
                  <input type="radio" name="status" value="Out" <?php if(isset($_POST['status']) && $status=="Out") echo "checked" ; ?> />
                  <span class="contentText">Out</span></td>
              </tr>
            </table>
          
              <div align="center">
                <p>
                  <input type="hidden" name="formSubmitted" value="TRUE" />
                  <input name="submit" type="submit" onclick="MM_validateForm('contact Number','','NisNum','email','','NisEmail','ext','','NisNum');return document.MM_returnValue" value="Create Staff" />
                  <input type="reset" value="Reset" />
                </p>
              </div>
            <?php } ?>        </td>
      </tr>
    </table>    
    <p><br />
      </p></td>
  </tr>
  <tr>
    <td colspan="4"><?php include("include/footer.php") ?></td>
  </tr>
</table>
</form>
</body>
</html>

 

Link to comment
https://forums.phpfreaks.com/topic/124614-different-layout-in-ie-and-safari/
Share on other sites

YOU'RE NOT USING CSS LAYOUT?

 

Man, I know it's hard, but it's best that you learn how to make a CSS layout.

 

Less code, less loading time, better control over the look, etc... Tables are for tabular data only.

 

Hrmm..sorry im new here, i only create css for text and font but not tables. is there a way to change it in the php?

 

thanks a LOTS!

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.