Welcome to Dream.In.Code
Become an Expert!

Join 149,530 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,511 people online right now. Registration is fast and FREE... Join Now!




2 different browsers show 2 different things.

 
Reply to this topicStart new topic

2 different browsers show 2 different things.

zkyevolved
8 Jun, 2007 - 09:50 AM
Post #1

New D.I.C Head
*

Joined: 4 May, 2007
Posts: 6


My Contributions
Hey everyone, I'm just a student and I use a blackberry to browse the net sometimes. A friend helped me write a program for my phone to help manage better my SMS's. OK, I have the code working great! But I use Opera Mini and the Default. one shows up nicely and the other ... very ugly! So my question is if someone can help me fix the code a little bit so they both look nice! I'll show you two pics :

http://web.zkentspain.com-a.googlepages.com/DSC05581.JPG when it looks good

http://web.zkentspain.com-a.googlepages.com/DSC05580.JPG when it doesn't look good!


I'm not sure what's making it look like that. I'm sure it has something to do with the javascript.
So ... if anyone could tell me a way to get around it I'd REALLY appreciate it! Thanks a lot!

Kent.

PS - If you look at the picture in which it looks bad, the text is lined, like each letter is on a different line. I don't understand it!

CODE
<?php

  include_once("dbconnect.php");



  if (isset($_GET['status']))

    $StatusMessage = $_GET['status'];

  else

    $StatusMessage = "Not Yet Sent";

    

  if (isset($_GET['to']))

    $to  = urldecode($_GET['to']);            

  else

    $to = "";



  if (isset($_GET['message']))

    $message = urldecode($_GET['message']);

  else

    $message = "";



  if (isset($_GET['charcount']))

    $charcount = $_GET['charcount'];

  else

    $charcount = "";



  if (strlen($charcount) > 1)

    $divTotalChars = strlen($message);

  else

    $divTotalChars = "0";



  $query     = "SELECT value FROM spn_totalSMSMessage";

  $result    = mysql_query($query, $conn);

  $reccount  = mysql_num_rows($result);



  if ($reccount)

  {

    $row                = mysql_fetch_assoc($result);

    $divTotalSMSMessage = $row["value"];

  }

  else

  {

    $divTotalSMSMessage = "0";

  }      



  $to      = stripslashes($to);

  $message = stripslashes($message);

?>



<html>

<head>

<title>Send An SMS</title>

</head>

<font face="verdana" size="2">



<script language="javascript">



  function encode4sending(msg)

  {

      result = msg;



      /*result = result.replace("#", "%23"); // fix #

      result = result.replace("'", "%60"); // fix '

      */

      result = escape(result);

      return result;

  }



  function openphonebook()

  {

   window.location.href = "phonebook.php?to=" + encode4sending(document.getElementById("to").value) + "&message=" + encode4sending(document.getElementById("message").value);

  }



  function opencharcount()

  {

   window.location.href = "index.php?to=" + encode4sending(document.getElementById("to").value) + "&message=" + encode4sending(document.getElementById("message").value) + "&charcount=true";

  }



  function openSMSArchive()

  {

      window.location.href = "SMSarchive.php?to=" + encode4sending(document.getElementById("to").value) + "&message=" + encode4sending(document.getElementById("message").value);

  }



</script>



<form method="post" action="index_submit.php">



<table>



  <td>

    <tr><a href="index.php">NEW SMS</a></tr><br>

    <tr><a href="#" onclick="opencharcount();">CHAR COUNT:</a><?php echo $divTotalChars; ?></tr>

  </td>

</table>



<p>To:



<input type="text" name="to" id="to" size="26" value="<?php echo $to; ?>">

<a href="#" onclick="openphonebook();">Phone Book</a><br><br>

<textarea name="message" id="message" cols="40" maxlength="160" rows="3"><?php echo stripslashes($message); ?></textarea><br><br>



<table>

<tr>

  <td><input type="submit" value="Send"></td>

  <td><div id="divStatus"><?php echo $StatusMessage; ?></div></td>

</tr>

</table>



<table width=20>

<tr>

<tr></tr>

<div id="divTotalSMSMessage"><?php echo "Total SMS Messages:".$divTotalSMSMessage; ?></div>

</tr>

<br>

<tr>

<a href="#" onclick="openSMSArchive();">SMS Archive</a>

</tr>

</table>

</p>

</p>



</form>

</font>

</html>


This post has been edited by hotsnoj: 8 Jun, 2007 - 02:00 PM
User is offlineProfile CardPM
+Quote Post

fyrestorm
RE: 2 Different Browsers Show 2 Different Things.
8 Jun, 2007 - 01:34 PM
Post #2

D.I.C Lover
Group Icon

Joined: 4 Apr, 2002
Posts: 3,103



Thanked: 2 times
Dream Kudos: 228
My Contributions
just off the top of my head, wouldn't that be a problem with how the browser is rendering the html? similar to how what you see in FF is not always what you see in IE?
User is offlineProfile CardPM
+Quote Post

Styx
RE: 2 Different Browsers Show 2 Different Things.
8 Jun, 2007 - 01:48 PM
Post #3

D.I.C Head
Group Icon

Joined: 4 Mar, 2007
Posts: 192


Dream Kudos: 225
My Contributions
Yeah, this isn't a php problem. There's nothing wrong with your php. A few things aren't needed or could be simplified, but it's fine otherwise.

It shows up fine in Firefox and IE, and the javascript looks ok. Probably a browser-specific problem.

What browser is the bad version in?
User is offlineProfile CardPM
+Quote Post

snoj
RE: 2 Different Browsers Show 2 Different Things.
8 Jun, 2007 - 01:59 PM
Post #4

Fell off the face of the earth
Group Icon

Joined: 31 Mar, 2003
Posts: 3,325



Thanked: 9 times
Dream Kudos: 750
My Contributions
Moved to HTML/CSS/Javascript
User is online!Profile CardPM
+Quote Post

zkyevolved
RE: 2 Different Browsers Show 2 Different Things.
8 Jun, 2007 - 09:59 PM
Post #5

New D.I.C Head
*

Joined: 4 May, 2007
Posts: 6


My Contributions
QUOTE(Styx @ 8 Jun, 2007 - 02:48 PM) *

Yeah, this isn't a php problem. There's nothing wrong with your php. A few things aren't needed or could be simplified, but it's fine otherwise.

It shows up fine in Firefox and IE, and the javascript looks ok. Probably a browser-specific problem.

What browser is the bad version in?


Blackberry Browser default Browser. I've gone into the options and changed the settings to ALL The browser emulations, and it doesn't work. Yet in Opera Mini, it works WONDERFULLY! Strange.

QUOTE(hotsnoj @ 8 Jun, 2007 - 02:59 PM) *

Moved to HTML/CSS/Javascript


How do I do that exactly? I use Dreamweaver. smile.gif Thanks!
User is offlineProfile CardPM
+Quote Post

Arbitrator
RE: 2 Different Browsers Show 2 Different Things.
11 Jun, 2007 - 10:16 AM
Post #6

D.I.C Regular
Group Icon

Joined: 26 Jan, 2005
Posts: 492



Thanked: 1 times
My Contributions
Perhaps if you fix your HTML code, the document will display properly in both. The current document is very poorly written and contains numerous errors. Some of the errors are listed below.
  • The document is missing a document type declaration. This, in particular, impacts how certain browsers will view your document (via quirks mode).
  • You have multiple elements that are in illegal contexts as defined by the HTML 4.01 specification.
    • The td and br elements may not occur as direct children of the table element.
    • The tr element may not occur as the direct child of the td element.
    • The font and table elements may not occur as direct childrem of the font element.
    • The div, tr, and a elements may not occur as direct children of the tr element.
  • tr elements must contain either a th or td element as a child.
  • The document contains two p element end tags that don’t match any p element start tags. At least one of these seems to be placed under the assumption that you can place a table element inside of a p element; since you cannot, the the presence of the table element results in the open p element being implicitly closed.
  • The content of a href attribute (#) contains an invalid URI.

Additionally, the document exhibits outdated or poor practice use of code (as shown below). These things are not technically errors, but should still be fixed.
  • The font element and its attributes are deprecated (obsolete) in favor of the CSS font, font-family, font-size, and color properties and should not be used.
  • The language attribute is deprecated in favor of the type attribute.
  • The width attribute on the table element is deprecated in favor of CSS width property. I believe, but I am not sure, that the same goes for the size attribute.
  • The br element should be avoided in favor of various CSS properties such as margin, padding, and CSS declarations such as display: block.
  • Your use of the p element is unsemantic. That element is used for marking up paragraphs; form control elements and a two‐word anchor element do not constitute a paragraph.
  • Your use of the table element is not semantic because said element is not being used to associate data.
  • You should declare your variables in JavaScript.
I’d fix all of the errors and poor usages and come back (or not if the rendering is fixed).

This post has been edited by Arbitrator: 11 Jun, 2007 - 10:18 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 08:57PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month