Hi everyone,
A very simple code that aims to know whether value was inserted to an input field in a form is not working :-(.
In the following code, when a value is inserted to field 'A" I want 'a' to be echoed and if 'b' recieves value the program should
show 'b' on the display.
Whether I insert a value or weather no value is inserted at all the following program always shows shows both 'a' and 'b'.
Can anyone help me with mnaking that program show 'a' only when 'a' was inserted value and 'b' only when be was inserted value?
A very simple code that aims to know whether value was inserted to an input field in a form is not working :-(.
In the following code, when a value is inserted to field 'A" I want 'a' to be echoed and if 'b' recieves value the program should
show 'b' on the display.
Whether I insert a value or weather no value is inserted at all the following program always shows shows both 'a' and 'b'.
Can anyone help me with mnaking that program show 'a' only when 'a' was inserted value and 'b' only when be was inserted value?
Code:
<?php //myIsset.php
$a = '';
$b = '';
if (isset($_GET['a'])) echo 'a<br>';
if (isset($_GET['b'])) echo 'b';
echo '
<!DOCTYPE html>
<html lang = "en">
<head>
<title>myIntval.php</title>
<meta charset="utf-8" />
</head>
<body>
<form action = "myIsset.php" method = "GET">
A <input type ="text" name = "a">
B <input type ="text" name = "b">
<input type = "submit" value = "convert">
</form>
</body>
</html>';
?>
Thanks !