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? Link to comment https://forums.phpfreaks.com/topic/28516-help-with-boxes/ 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] Link to comment https://forums.phpfreaks.com/topic/28516-help-with-boxes/#findComment-130477 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 :-[ Link to comment https://forums.phpfreaks.com/topic/28516-help-with-boxes/#findComment-130484 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? Link to comment https://forums.phpfreaks.com/topic/28516-help-with-boxes/#findComment-130489 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? Link to comment https://forums.phpfreaks.com/topic/28516-help-with-boxes/#findComment-130492 Share on other sites More sharing options...
Vmi90 Posted November 26, 2006 Author Share Posted November 26, 2006 Sweet, thanks Link to comment https://forums.phpfreaks.com/topic/28516-help-with-boxes/#findComment-130494 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. Link to comment https://forums.phpfreaks.com/topic/28516-help-with-boxes/#findComment-130496 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] Link to comment https://forums.phpfreaks.com/topic/28516-help-with-boxes/#findComment-130498 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.