Vmi90 Posted November 26, 2006 Share Posted November 26, 2006 Ok, so far i have this:<form method="GET" action="send.php">Username: <input name="name" type="text" size="30" class="box"><input type="submit" value="Calc">I want to make it so whatever you put in the box, it becomes a variable, but when you click "calc", i dont want it to send you to another page. Can someone help me finish that code? Quote Link to comment Share on other sites More sharing options...
taith Posted November 26, 2006 Share Posted November 26, 2006 [code]<?$var=$_POST[name];?><form method="GET" action="?">Username: <input name="name" type="text" size="30" class="box"><input type="submit" value="Calc">[/code] Quote Link to comment Share on other sites More sharing options...
theironchef Posted November 26, 2006 Share Posted November 26, 2006 if you want to do work usign the variables done in the form after you hit submit try this in the top <?php section[code]<?phpif($_POST['Calc']){ $name=$_POST['name']; // this gets the variable only after you hit submit}?>[/code]help any? not sure what you are wanting to be honest :-[ Quote Link to comment Share on other sites More sharing options...
Vmi90 Posted November 26, 2006 Author Share Posted November 26, 2006 [quote author=taith link=topic=116351.msg473996#msg473996 date=1164553705][code]<?$var=$_POST[name];?><form method="GET" action="?">Username: <input name="name" type="text" size="30" class="box"><input type="submit" value="Calc">[/code][/quote]But then how would i make it echo the name once u click calc? Quote Link to comment Share on other sites More sharing options...
theironchef Posted November 26, 2006 Share Posted November 26, 2006 wherever in the code you'd like lolum say u wanted it here...[code]<body><table><? echo $name ?></table></body>[/code]u dig? Quote Link to comment Share on other sites More sharing options...
Vmi90 Posted November 26, 2006 Author Share Posted November 26, 2006 Sweet, thanks Quote Link to comment Share on other sites More sharing options...
Davka Posted November 26, 2006 Share Posted November 26, 2006 This tutorial will answer your question:http://www.webmonkey.com/webmonkey/01/48/index2a.html?tw=programmingPHP forms are magic, pure and simple. If you don't believe in faeries, they won't work. Quote Link to comment Share on other sites More sharing options...
taith Posted November 26, 2006 Share Posted November 26, 2006 [code]<?$var=$_POST[name];?><form method="GET" action="?">Username: <input name="name" type="text" size="30" class="box" value="<?=$var?>"><input type="submit" value="Calc">[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.