IE and Firefox Problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
genista
Forum Commoner
Posts: 57
Joined: Fri Aug 18, 2006 3:56 pm

IE and Firefox Problem

Post by genista »

Please excuse the script below its work in progress and I have a path to follow to get it complete. However, in early testing I find that in Firefox the complete script works, in IE when I hit the submit button, nothing happens. What it should do is run an insert query as you can see. Instead the page returns the query hasn't run, it hasn't updated the database:

Code: Select all

<?php  
session_start(); 
include_once ("../../private/supplierconfig.php");  
checkLoggedIn("yes"); 
error_reporting (E_ALL);  

//Retrieve details from database to start (image1 also part of suppliers table - need to have this only ) 

$id = $_SESSION['username']; 
echo $id; 


$query = "SELECT suppliers.supplierid, suppliers.username 
FROM suppliers 
LEFT JOIN supplierimages USING (supplierid) WHERE suppliers.username = '$id'"; 

        $result=mysql_query($query, $link) or die("MySQL query $query failed.  Error if any: ".mysql_error()); 

echo $query; 
    //get the first (and only) row from the result  
    $row = mysql_fetch_array($result, MYSQL_ASSOC);  


  $supplierid = $row['supplierid']; 
  echo $supplierid; 
    
        
       
      if(isset( $submit ))  
{       

//If the Submitbutton was pressed do:  
  
if ($_FILES['imagefile']['type'] == "image/jpeg"){  


  
 $_FILES['imagefile']['name'] = basename($_FILES['imagefile']['name']); 

copy ($_FILES['imagefile']['tmp_name'], "files/".$username.$_FILES['imagefile']['name']) 
    or die ("Could not copy");  
      

echo "";   
        echo "Name: ".$_FILES['imagefile']['name']."";   
        echo "Size: ".$_FILES['imagefile']['size']."";   
        echo "Type: ".$_FILES['imagefile']['type']."";   
        echo "Upload Complete....";  

       
      
        $image1 = $username.$_FILES['imagefile'] ['name']; 
         
        echo "$image1";  
         
     
      
     $query = "INSERT INTO  
supplierimages (image1, supplierid)  
VALUES ('$image1','$supplierid')";        
               
              $result = mysql_query($query, $link) or die('Update failed: ' . mysql_error());  
echo $query;  
echo $id; 
//print_r($query);   
 mysql_info($link) ;  
    if(mysql_affected_rows($link) == 0);   
         
        }  
} 
 else {  
            echo "<br><br>";  

        }  
  


?> 


   </script> 

</HEAD> 

<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
    <form name="form1" method="post" action="#" enctype="multipart/form-data"> 
    <input type=text name="username" value="<?php echo $username; ?>">  
    <input type="file" name="imagefile">  
    <p>*</td><td><input name="submit" type="submit" value="Submit"></p>  
    </table>  
   </form>
Thanks,

G
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

genista wrote: </script>

</HEAD>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<form name="form1" method="post" action="#" enctype="multipart/form-data">
/script, /head, html, head, meta, form? This might be the "most invalid html document of week" ;) Please fix it.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Funny thing about that garbled code is that IE usually renders it while a more standards compliant browser like FF or Opera would usually choke on it.
Post Reply