I have the following html form i am testing out.
<html>
<head>
<link href = "style.css" rel = "stylesheet" type = "text/css">
</head>
<form action = "test1.php" enctype = "multipart/form-data" method = "POST">
<input type = "hidden" name = "playno" value = "testing">
<input type = "image" src = "uploads/defb.png" name = "submit" value = "submit"/>
</form>
</html>
The following is saved in "test1.php":
<?php
$hiddenvalue = $_POST['playno'];
if (isset($_POST['submit'])){
echo "OK";
}
else
{
echo "error";
}
?>
In the broswer i am returned the value "testing" when i print $hiddenvalue. However each and every time it outputs "error" as well, not "OK".
I would greatly appreciate any help. It is driving me mad!!! Many thanks in advance.
Just add this inside the form:
So that it receives the
$_POST['submit']
in your PHP.When using a
input type="image"
, the browser sendssubmit_x
andsubmit_y
.So in PHP,
$_POST['submit']
will not be available, but$_POST['submit_x']
and$_POST['submit_y']
will be defined (containing the X/Y coordinates where the image was clicked on).change to:
Because input didint have this type
create style for input HTML
CSS