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

Recommended Answers

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>

Jump to Post

All 2 Replies

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>

As Minitauros said, try like that. its working for me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.