passing value from html to php



i am trying to use conform dialog before i commit to delete a file. I am having problems passing the value from the javascript (i:e the choice) to php the value i want is in temp which is outside php. any idea how i can pass this value? :?:
        echo "<tr><td align=right>";
        <input type=submit name=button value='Delete' onClick="temp = window.confirm('Would you like to confirm?'); window.status=(temp)?'confirm: true':'confirm: false';"></td></tr>      
        echo "</table>";
	echo "<input type=hidden name='db' value='".$db."'>";
        echo "<input type=hidden name='choice' value='".$temp ."'>";
        echo "</form>";
echo "the confirm dialog javascript code ";
echo "(js) if (ret==1) {
window.location(yes go on delete it)
do nothing

note!:is only a pseudo code

got the idea what I am saying.
you make all your javascript code and decision inside php.
<script language="javascript">
function validateconf()
 if (confirm("Do you want to delete the file?")) {
   return true;
 else {
   return false;

<form name="" onsubmit="return validateconf()">
<input type=submit value="Submit">