Hi,
Im writing a form which accepts the file name and a number from the user and if the user clicks the submit button, it loads the file link to the database.
<FORM METHOD=POST ACTION="<?echo $PHP_SELF;
?>">
File:<INPUT TYPE=FILE NAME="file">
<INPUT TYPE=BUTTON VALUE="Submit"
onClick="sconfirm()">
</FORM>
<SCRIPT LANGUAGE="JavaScript">
var msg="Are You Sure?";
if(confirm(msg)) {
document.write("<INPUT TYPE=HIDDEN
NAME=\"a\" VALUE=\"1\">");
}
else {
document.write("<INPUT TYPE=HIDDEN
NAME=\"a\" VALUE=\"0\">");
}
I tried to use the confirm()function of Javascript in-order to alert the user and ask whether the user is sure to submit the file...But I couldnt somehow get it to work.
Im using the value stored in a to perform further processing of input using PHP
such as:
if($a) {
//perform input validation
}
else {
//ask file name from the user
}
Your Help is appreciated.
Greg