0

Dear Sir,

I have following codes

<?php
$var2="";
$name="";
if (isset($_POST['button1']) && !empty($_POST['text1'])) {
$name=$_POST['text1'];
if ($name=="1") {
$var2="1";
}else{
$var2="0";
}
}
?>

<html>
  <head>
    <title>
      First form
    </title>
  </head>
    <body>  
    <form name="aa" action="textboxes.php" method="Post">
      First<input type="text" name="text1" value=""><br>
      Second<input type="text" name="text2" value="<? echo $var2; ?>" disabled><br>
      <input  type="submit" value="Display" name="button1">
    </form>
    </body>
</html>

If I enter 1 in text1 then text2 must show 1 else text2 must show 0

Please see what is wrong in my codes.

Thanks

3
Contributors
2
Replies
16
Views
3 Years
Discussion Span
Last Post by rpv_sen
0

Maybe your PHP installation does not support shortcodes. You could try using

Second<input type="text" name="text2" value="<?php echo $var2; ?>" disabled><br>

instead of

Second<input type="text" name="text2" value="<? echo $var2; ?>" disabled><br>

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.