Jump to content

PHP runs differently on different browsers ? Surely not !!


Recommended Posts

To cut a long story short ...

I have a simple piece of HTML in which there is a small box on the screen contained in an <OBJECT> tag.

Into the <OBJECT> gets loaded various PHP programs depending on what the user selects.

 

In one of these programs, a simple MySQL UPDATE query is performed on a database table.

 

Amazingly, the MYSQL update works when I surf with Firefox or IE7 but not when I surf with IE8.

 

Yet I thought PHP always ran on the server and therefore its action should be totally independent of whatever browser you are using.

 

My head is absolutely drained with this one.  Anybody any ideas ?????

Okay here we go

 

Here is the bit of HTML in the main outer bit of the page, which has an <object> in it.

 

<BR>

<object type="text/html" name = "myobject" data="<?=$query[0];?>.php?<?=$query[1];?>" style="width:695px;height:80px;">

<p>Your browser does not support inline objects. Please call Data & Go tech support.</p>

</object>

 

 

As you can see, depending on the values of $query[0] and $query[1], a different PHP file gets loaded, so if $query[0] = "foo" and $query[1] = "bar" then foo.php?bar gets loaded in.

 

 

Now, I have a program called jobs.php which accepts different query strings.

Here is jobs.php?list  (or at least here is the meaty bit of it)

 

It diplays a list of jobs onthe screen and asks the user to select one with a radio button

 

 

if ($action[0] == 'list') {

echo '<FORM NAME = "jobform" ACTION = "jobs.php?set" METHOD = "POST" ENCTYPE = "MULTIPART/FORM-DATA">'.PHP_EOL;

echo '<TABLE CELLPADDING="0" CELLSPACING="0">'.PHP_EOL;

for ($formcounter = 0; $formcounter < $jobii; $formcounter++) { // ie for each of the valid jobs

echo "<TR VALIGN='BOTTOM'>".PHP_EOL;

echo "<TD VALIGN = 'BOTTOM'>".PHP_EOL;

echo "<H3><INPUT TYPE = 'RADIO' NAME = 'job' VALUE = '".$validjob[$formcounter]."'> ".$validjob[$formcounter].PHP_EOL;

echo "</TD>".PHP_EOL;

echo "</TR>".PHP_EOL;

}

 

echo '<TR><TD COLSPAN = "2"><BR><INPUT TYPE = "SUBMIT" VALUE = "SUBMIT"></TD></TR>'.PHP_EOL;

echo '</TABLE>'.PHP_EOL;

echo '</FORM>',PHP_EOL;

}

 

 

And that whizzes off to jobs.php?set in which the following code takes place

 

Basically it updates a mysql table with the values of $whichUser and $newjob which have been passed from previously.

 

 

if ($action[0] == 'set') { // then set the job number into the mySql database

$newjob = $_POST['job'];

// does this user already have a record ?

$already_in = mysql_num_rows(mysql_query("SELECT staff_id FROM job_cookie WHERE staff_id = '$whichUser'"));

if ($already_in > 0) { // then its an UPDATE query !

echo 'User already in. Updating '.$newjob.' for '.$whichUser;

mysql_query("UPDATE job_cookie SET job_no = '$newjob' WHERE staff_id = '$whichUser'");

}

else { // if not, create an entry for that person

echo 'New user. Updating '.$newjob.' for '.$whichUser;

mysql_query("INSERT INTO job_cookie(staff_id, job_no) VALUES ('$whichUser', '$newjob')");

}

}

 

Now here is the most bizarre thing !!!! - In ALL browser versions, my degugging statements display the correct values of $whichUser and $newjob on the screen !!!!!

 

HOWEVER - only in Firefox and IE7 does the mysql database actually get updated with the new values !!

 

Something VERY weird is going on.

But it does !  And even if IE8 is a bit buggy it STILL shouldn't make a difference

 

I'm starting to think further afield to permissions to change database entries but this particular table is no different to any other in the database and they all update okay

But it does !  And even if IE8 is a bit buggy it STILL shouldn't make a difference

 

I'm starting to think further afield to permissions to change database entries but this particular table is no different to any other in the database and they all update okay

 

IE8 is beta, whocares if it works on it lol.

 

Chances are, and this is a pure guess is that IE8 is being picky about the html and it probably needs to be setup a certain way. I would do a print_r($_POST); in your script and see what prints in IE8 vs FF. See if they are forumalted differently or what. It could just be that IE forms submitting is flawed and that is why your database does not update.

 

I have yet to use IE8, so yea this is purely ways to debug this situation.

 

My bet, is IE8 has a bug on the form submital process since it is BETA.

But it does !  And even if IE8 is a bit buggy it STILL shouldn't make a difference

PHP doesn't run on the browser, it doesn't know (or even care) what browser it is generating the HTML for.

It's the HTML, or javascript, or css that's generated by PHP which runs in the browser.

Exactly.  So why does my PHP code run perfectly in one browser and not in another ?  That is the thing that is freaking me out.

 

HTML is the simple key. As stated, IE8 is beta Chances are not everything is running smooth yet. IMO do not code for IE8 right now, wait until there is an official release that is not buggy.

 

Stop worrying about, it is not a huge issue at all. I am sure if you google IE8 form data process something like that you may find a few bug reports.

 

Stop coding for beta. As long as it works on the current production browsers:

IE7, FF3, Opera, Safari, and Chrome you are golden. Chances are it is a BUG in IE8.

IE8 won't even display half the worlds webpages properly. Loads of sites load but just a blank screen. serious problems with html .js and css, you can click on the tab of IE8 and change to compatability view which normally works by allowing you to view like IE7

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.