Jump to content
xisto Community
Sign in to follow this  
kvarnerexpress

Script That Deletes A Row In A Mysql Database Usin

Recommended Posts

I have just made a script that deletes a row in a mysql database using an image as a button.

However it will only work in FireFox and not in IE.
Can any one see away around this and help me root out the problem.

This is the script in short:
PHP Code:

$query_products = "SELECT * FROM manufacturer ORDER BY name ASC";include('external_files/pagination.php');    // If the form was submitted, delete the items selected from the databaseif(isset($_POST['delete'])){  $query = 'DELETE FROM manufacturer WHERE manufacturer_id = '.(int)$_POST['delete']; // or die() doesn't go here  $result = mysql_query($query) or print mysql_error();echo"{$row_products['manufacturer_id']}";        if ($result) { // If it ran OK.            echo" <center><font color=\"#00CC00\">The manufacturer was Deleted!</font></center> ";            $query_products = "SELECT * FROM manufacturer ORDER BY name ASC";            include('external_files/pagination.php');        } else { // If it did not run OK.                // Send a message to the error log, if desired.                echo"<div class='error'>The manufacturer could not be deleted due to a system error. We apologize for any inconvenience.</div>";            }        }?><!-- Call your variables -->

and:
PHP Code:
//.....etc etcdo {     ?><form action="<?php echo $PHP_SELF; ?>" method="post"><?                    //Open all the items            echo"                                    <div class='item'>                                        <div class='element'>{$row_products['name']}</div>                                        <div class='element'>00/00/00</div>                                        <div class='elementprimtool'>";?><input type="image" name="delete"  src="images/delete.jpg"  value="<?php echo $row_products['manufacturer_id'] ?>" /><?

Share this post


Link to post
Share on other sites

OK, try changing it so that it is all on one line, e.g.

<input type="image" name="delete" src="images/delete.jpg" value="<?php echo $row_products['manufacturer_id'] ?>" />

You could also try changing the closing tag, so you don't have a slash. Sometimes it can cause problems. I think you also need a ; after that PHP you have in the value attribute.

<input type="image" name="delete" src="images/delete.jpg" value="<?php echo $row_products['manufacturer_id']; ?>">

Tell us if that helps.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.