Namunukula Posted June 7, 2007 Share Posted June 7, 2007 Please read my scripts and question in the below.. and help me ....This is my "testpage1.html" file<html><head></head><body><form action="testpage2.php" name="input" method="post">Enter Your User Name:<input type="text" name="name1" /><br />Get your code:<input type="text" name="vcode1" /><br /><input type="submit" value="View code" /></form></body></html>This is "testpage2.php" file<html><head></head><body> <?php $uname=$_POST["name1"]; $vcode=$_POST["vcode1"]; switch ($uname) { case ex1: $vcode=1000; $_POST["vcode1"]=$vcode; echo $_POST["vcode1"]; break; }?></body></html>Accordion to this scripts.. .I want to add 1000 to text box "vcode1". but the "1000" display in another page separately. How can I get that to text box "vcode1". Pls explain that clearly.. bcos I am new to PHP. Thanks. Link to comment Share on other sites More sharing options...
vijay Posted June 7, 2007 Share Posted June 7, 2007 Hi..am explainning you the following code:-----------------------------------------------switch ($uname){case ex1:$vcode=1000;$_POST["vcode1"]=$vcode;echo $_POST["vcode1"];break;}--------------------------------------------------if you have enter uname then it'll goes into switch block..compare it with ex1,if matches then1000 will be assigned to $vcode and that $vcode again you r assigning to $_POST["vcode1"]and echoing it..so it will print 1000;suppose this will help you out.. but still not getting by this what you want to do..?Regards,Vijay Link to comment Share on other sites More sharing options...
Namunukula Posted June 7, 2007 Author Share Posted June 7, 2007 Hi..am explainning you the following code:-----------------------------------------------switch ($uname){case ex1:$vcode=1000;$_POST["vcode1"]=$vcode;echo $_POST["vcode1"];break;}--------------------------------------------------if you have enter uname then it'll goes into switch block..compare it with ex1,if matches then1000 will be assigned to $vcode and that $vcode again you r assigning to $_POST["vcode1"]and echoing it..so it will print 1000;suppose this will help you out.. but still not getting by this what you want to do..?Regards,VijayHi Vijay,Thank you very much for come to help me. I want to print that 1000 in the text box call "vcode". What can I do for that? Please help me. Link to comment Share on other sites More sharing options...
vijay Posted June 7, 2007 Share Posted June 7, 2007 Hi.. that mean whatever you have posted that you want to display in the text box.. am i right..? that means you are posting the form on the same page.. if yes then you can Enter Your User Name: <input type="text" name="name1" value="<?php echo $_POST['name1'];?>" /><br /> Get your code: <input type="text" name="vcode1" value="<?php echo $_POST['vcode1'];?>"/><br /> Regards,Vijay Link to comment Share on other sites More sharing options...
Namunukula Posted June 7, 2007 Author Share Posted June 7, 2007 Hi.. that mean whatever you have posted that you want to display in the text box.. am i right..? that means you are posting the form on the same page.. if yes then you can Enter Your User Name: <input type="text" name="name1" value="<?php echo $_POST['name1'];?>" /><br /> Get your code: <input type="text" name="vcode1" value="<?php echo $_POST['vcode1'];?>"/><br /> Regards,VijayHi Vijay,I tried it with your instructions... but that 1000 print in out of text box. How to display it inside the text box. Link to comment Share on other sites More sharing options...
vijay Posted June 7, 2007 Share Posted June 7, 2007 Hi...Use the following code...have change the action.. and am posting the form on the same page..Regards,Vijay--------------------------------------------------------------------------------<?phpif(isset($_POST['submit'])){ $uname=$_POST["name1"]; $vcode=$_POST["vcode1"];}?><html><head></head><body><form action="testpage1.php" name="input" method="post"><input type="text" name="name1" value="<?php echo $_POST['name1'];?>" /><br />Get your code:<input type="text" name="vcode1" value="<?php echo $_POST['vcode1'];?>"/><br /><input type="submit" name="submit" value="View code" /></form></body></html> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.