therif Posted March 14, 2006 Share Posted March 14, 2006 Hi,I'm new to PhP, but I coded already a lot in C++, so PhP is quite similarBut thats not the pointI want to paste a countervariable to a $_GET Well, this is the code :)This here works fine:<form id="add" name="add" method="get" action="BBCode.php"> <label></label><?phpwhile($teller <= $quantity){echo "Omschrijving van object nummer ", $teller?> <p> </p> <table width="250" border="9"> <tr> <td>Verkoop van </td> <td> <select name="cmbType<?php echo $teller ?>" id="cmbType">//... Some html form code </p><?php$teller++;}?><input type="hidden" name="txtQuantity"id="txtQuantity" value="<?php echo $quantity?>" /> <input type="submit" name="Submit" value="Submit" /></form> </body></html>----------------------------------As you can see, in another previous page i setted a quantity and here the counter(teller) is going to loop.everytime I got a name, I add the number so I can process it on next page...This code here is Ok, now I used the Get method, the next page have to take these, and for the moment only echo it, if I can echo, I can do everything else :)---------------------------------<body><?php$Quantity = $_GET['txtQuantity'];$teller = 1; while ($teller < Quantity){ $Type = $_GET['cmbType'];//here, how do I add a counter so he can read the get with a counter next to it $Model = $_GET['txtModel']; $Description = $_GET['txtDescription']; $Official_Link = $_GET['txtOfficial']; $Directory_Link = $_GET['txtLinkDir']; $Min_Price = $_GET['txtMinPrice']; $Buy_It = $_GET['txtBuyIt']; $Richtprijs = $_GET['txtDunno']; $Introductie = $_GET['txtIntro']; $Slot = $_GET['txtEnd']; ?> <link href="topicgen.css" rel="stylesheet" type="text/css" /><?phpecho "Hello World in while";echo $Quantity;echo $Type;echo $Model;echo $Description;echo $Official_Link;echo $Directory_Link;echo $Min_Price;echo $Buy_It;echo $Richtprijs;echo $Introductie;echo $Slot;$teller++;}echo $Type;?></body>Like this :) if you need more information, just PM meHere is the test site [a href=\"http://therif.free.fr/testingtg/\" target=\"_blank\"]http://therif.free.fr/testingtg/[/a]It is in dutch... but just write a quantity inferior to 10 in first page, and u can directly submit on next page Link to comment https://forums.phpfreaks.com/topic/4908-cannot-read-variables-with-a-counter/ Share on other sites More sharing options...
redarrow Posted March 14, 2006 Share Posted March 14, 2006 use sessions[!--sizeo:6--][span style=\"font-size:24pt;line-height:100%\"][!--/sizeo--]corrected post below[!--sizec--][/span][!--/sizec--]good luck[code]page1.php<?phpsession_start();$_SESSION['1'] = 1;$_SESSION['2'] = 2;$_SESSION['3'] = 3;?>[/code][code]page2.php<?phpsession_start();echo ".$_SESSION['1'] .";echo ".$_SESSION['2'] .";echo ".$_SESSION['3'] .";?>[/code] Link to comment https://forums.phpfreaks.com/topic/4908-cannot-read-variables-with-a-counter/#findComment-17297 Share on other sites More sharing options...
therif Posted March 14, 2006 Author Share Posted March 14, 2006 [!--quoteo(post=354821:date=Mar 14 2006, 10:49 AM:name=redarrow)--][div class=\'quotetop\']QUOTE(redarrow @ Mar 14 2006, 10:49 AM) [snapback]354821[/snapback][/div][div class=\'quotemain\'][!--quotec--]use sessionsgood luck[code]page1.php<?phpsession_start();$_SESSION['1'] = 1;$_SESSION['2'] = 2;$_SESSION['3'] = 3;?>[/code][code]page2.php<?phpsession_start();echo ".$_SESSION['1'] .";echo ".$_SESSION['2'] .";echo ".$_SESSION['3'] .";?>[/code][/quote]k, thx;) I'll try it Link to comment https://forums.phpfreaks.com/topic/4908-cannot-read-variables-with-a-counter/#findComment-17299 Share on other sites More sharing options...
redarrow Posted March 14, 2006 Share Posted March 14, 2006 [!--quoteo(post=354823:date=Mar 14 2006, 09:55 AM:name=Rifton)--][div class=\'quotetop\']QUOTE(Rifton @ Mar 14 2006, 09:55 AM) [snapback]354823[/snapback][/div][div class=\'quotemain\'][!--quotec--]k, thx;) I'll try it[/quote][a href=\"http://www.tizag.com/phpT/phpsessions.php\" target=\"_blank\"]http://www.tizag.com/phpT/phpsessions.php[/a]everythink you need okgood luck Link to comment https://forums.phpfreaks.com/topic/4908-cannot-read-variables-with-a-counter/#findComment-17300 Share on other sites More sharing options...
redarrow Posted March 14, 2006 Share Posted March 14, 2006 sorry i made a makup sorry edited and corrected.page1.php[code]<? session_start();$_SESSION['john']='1';$_SESSION['james']='2';$_SESSION['lucky']='3';echo"<a href='page2.php'>loaded session</a>";?>[/code]page2.php[code]<?phpsession_start();echo $_SESSION['john'];echo $_SESSION['james'];echo $_SESSION['lucky'];?>[/code] Link to comment https://forums.phpfreaks.com/topic/4908-cannot-read-variables-with-a-counter/#findComment-17309 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.