i am trying to delete a data after using it to pre-populate a form, but it is deleting before pre-populating the form.

PHP Code:

//form data
$Sname mysql_real_escape_string(htmlentities(strip_tags($_POST['Sname'])));
$Pname mysql_real_escape_string(htmlentities(strip_tags($_POST['Pname'])));
$Pidno mysql_real_escape_string(htmlentities(strip_tags($_POST['Pidno'])));
$Psize mysql_real_escape_string(htmlentities(strip_tags($_POST['Psize'])));
$Pcolour mysql_real_escape_string(htmlentities(strip_tags($_POST['Pcolour'])));
$Pquantity $_POST['Pquantity'];
$Weblink mysql_real_escape_string(htmlentities(strip_tags($_POST['Weblink'])));
$Price mysql_real_escape_string(htmlentities(strip_tags($_POST['Price'])));
$comment mysql_real_escape_string(htmlentities(strip_tags($_POST['comment'])));
$date date("Y-m-d");

//echo " ('','$Sname','$Pname','$Pidno','$Psize','$Pcolour','$Pquantity','$Weblink','$Price','$Uname')";

if (
if (
$repeatheck mysql_query("SELECT * FROM repplac WHERE Uname = '{$_SESSION['username']}' AND Pidno ='$Pidno' AND Sname='$Sname' AND Pname='$Pname'");
$count mysql_num_rows($repeatheck);
    die (
$tprice $Price $Pquantity;
$queryreg mysql_query("
INSERT INTO repplac VALUES ('','
)or die(mysql_error());
'price field requires numbers';
'please fill in all required * fields ';
$deletetable mysql_query("DELETE FROM addingprod WHERE Uname = '{$_SESSION['username']}';
<form action='youraccount.php' method='Post' class='ilistbar'>
	<label for='shoppinglist' class='fixedwidth'></label>
	<textarea type='text' name='shoppinglist' id='username' cols='100' rows='15'></textarea>
	</div> -->
	<label for='Sname' class='fixedwidth'> * Shop name</label>
	<input type='text' name='Sname' id='Sname' value='
PHP Code:
<?php $addprodresult mysql_query("SELECT * FROM addingprod WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());$row mysql_fetch_array($addprodresult); echo $row{Sname}; ?>
'/> </div> <div> <label for='Pname' class='fixedwidth'> * Product name</label> <input type='text' name='Pname' id='Pname' value='
PHP Code:
<?php $addprodresult mysql_query("SELECT * FROM addingprod WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());$row mysql_fetch_array($addprodresult); echo $row{Pname}; ?>
'/> </div> <div> <label for='Pidno' class='fixedwidth'> * Product id no /ad reference</label> <input type='text' name='Pidno' id='Pidno' value='
PHP Code:
<?php $addprodresult mysql_query("SELECT * FROM addingprod WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());$row mysql_fetch_array($addprodresult); echo $row{Pidno}; ?>
'/> (This should be unique for each product) </div> <div> <label for='Psize' class='fixedwidth'>Product size</label> <input type='text' name='Psize' id='Psize' value='
PHP Code:
<?php $addprodresult mysql_query("SELECT * FROM addingprod WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());$row mysql_fetch_array($addprodresult); echo $row{Psize}; ?>
'/> </div> <div> <label for='Pcolour' class='fixedwidth'>Product colour</label> <input type='text' name='Pcolour' id='Pcolour' value='
PHP Code:
<?php $addprodresult mysql_query("SELECT * FROM addingprod WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());$row mysql_fetch_array($addprodresult); echo $row{Pcolour}; ?>
'/> </div> <div> <label for='Pquantity' class='fixedwidth'>Product quantity</label> <select name="Pquantity" id="Pquantity"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> (You can update quantity in excess of 10 on the shopping list below) </div> <div> <label for='Weblink' class='fixedwidth'> * Web link</label> <input type='text' name='Weblink' id='Weblink' value='
PHP Code:
<?php $addprodresult mysql_query("SELECT * FROM addingprod WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());$row mysql_fetch_array($addprodresult); echo $row{Weblink}; ?>
'/> </div> <div> <label for='Price' class='fixedwidth'> * Price GBP</label> <input type='text' name='Price' id='Price' value='
PHP Code:
<?php $addprodresult mysql_query("SELECT * FROM addingprod WHERE Uname = '{$_SESSION['username']}'") or die(mysql_error());$row mysql_fetch_array($addprodresult); echo $row{Price}; ?>
'/> Please valid format is (.) for decimal </div> <div> <label for='comment' class='fixedwidth'> Extra info</label> <input type='text' name='comment' id='comment'/> Please give different colours , sizes of the same products,discount codes, and other information that you would like us to use </div> <div> <div class='buttonarea'> <p> <input type='submit' name='submit' value='Add'> </p> </div> </p> </form>