Help with adding item in admin

Discussion in 'PHP' started by scriptsy26, Jan 28, 2011.

  1. #1
    Hello

    I have an admin panel where i can add item to sell or display to customers.
    But if i add an item there is a text"do not refresh this page or you will add it again"
    So everytime i add an item and whant to add another item the previous item disappears.
    How can i change that, so i can reload the page and then the item is added.

    Is this something that i need to change in the phpadmin? or can i change the script below.

    Thanks for helping me.


    <?php if($_GET['add'] == 1) { $uuq_db_item1 = $_POST["sitem1"]; $uuq_db_cost1 = $_POST["scost1"]; $uuq_db_imag1 = $_POST["simage1"]; $time1 = time(); $ext1 = $_FILES['itemimage1']['name']; $ext1 = strrev($ext); $ext1 = str_replace(strstr($ext,"."),"",$ext); $ext1 = strrev($ext); move_uploaded_file($_FILES['itemimage1']['tmp_name'],"../img/items/cat1/".$time1.".".$ext1) or die ("Could not process image file - make sure you CHMODed the img folder to 0777"); mysql_query("INSERT INTO ".$db_table_prefix."Catcat1 VALUES(null, '".$uuq_db_item1."' , '".$uuq_db_cost1."', 'img/items/cat1/".$time1.".".$ext1."')"); Echo('<div id="update"><h4>An item has been added, do not refresh this page, or you will add it again. <br /> <a href="index#">Click to reload this page</a></h4></div>'); } else { } ?>
     
    scriptsy26, Jan 28, 2011 IP
  2. dsdf

    dsdf Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Sorry, your code crowded. But from your script, looks like when you uploaded the file, although it is not displayed on the browser, it's already stored on the server.
     
    dsdf, Jan 30, 2011 IP