0

I am using a WAMP server. The form is not passing the $_GET["width"] variable when the form is submitted. Every time the form is submitted "fail" is echoed. I've been staring at it for hours, can someone please help?

<!DOCTYPE html>
<html>
<body>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<?php 

if($_SERVER["REQUEST_METHOD"] == "GET"){
    if(isset($_GET["width"])){
        echo "success!";}
    else{echo "fail";}
}
?>

<form action = "index.php" method = "get">
Width:
<input type="number" id="width" value="2400">
<input type = "Submit" value = "submit">
</form>

</body>
</html>
  • @davidal is correct but I just wanted to mention the whole checking if the request method is GET statement is unnecessary, checking if the variable is set it all that's needed. – Andy Sep 10 '15 at 10:52

1 Answers1

2

add a name="width" to your input and it should work

<input type="number" name="width" id="width" value="2400">
Diogo
  • 711
  • 6
  • 12