There is a form in adminhome.php?action=addbook
named addbook
<form name="addbook" action="adminhome.php?action=addbook" method="get" onsubmit="validatenumber();">
Code:<br/><input type="text" name="code" ><br/>
Class:<br/><input type="number" name="class" id="class1"><br/>
title:<br/><input type="text" name="title"><br/>
price:<br/><input type="number" name="price" id="price"><br/>
quantity:<br/><input type="number" name="quantity" id="quantity"><br/>
category:<br/><input type="text" name="category"><br/>
<input type="submit" value="submit"><br/>
</form>
What should be the correct action in the form action attribute given below?
action="adminhome.php?action=addbook&addbook.php"
Actually when I submit form it is not getting validated.
<script language="javascript">
function validatenumber(){
var class1=document.getElementByName("class")[0];
if(parseInt(class1.value, 10) < 0){
alert("Please enter positive integer");
return false;
}
}
</script>
<form name="addbook" action="adminhome.php" method="get" onsubmit="validatenumber();"> Code:<br/><input type="text" name="code" ><br/> Class:<br/><input type="number" name="class" id="class1"><br/> title:<br/><input type="text" name="title"><br/> price:<br/><input type="number" name="price" id="price"><br/> quantity:<br/><input type="number" name="quantity" id="quantity"><br/> category:<br/><input type="text" name="category"><br/> <input type="hidden" name="action" value="addbook"> <input type="submit" value="submit"><br/> </form>
That would make all of the form inputs and the action available in the $_GET[] global in file adminhome.php
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.