NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page help w/ $_POST in PHP

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 02-23-2005, 06:56 PM THREAD STARTER               #1 (permalink)
NamePros Member
Join Date: Jan 2005
Location: Texas USA
Posts: 71
Outer is an unknown quantity at this point
 



help w/ $_POST in PHP


Heres my problem, I have a bunch of variables sent from a form that takes on the look:

planet1
planet2
planet3
planet4
planet5
ect.
ect.
ect.

heres the IF statement that it is sent to:
PHP Code:
IF ($_POST[Submit] == "Submit") {
????: NamePros.com http://www.namepros.com/programming/71755-help-w-_post-in-php.html
   for (
$a "1"$a <= "380"$a++) {
     
$planet $_POST[planet$a];

   }

I get the error: Parse error: parse error, unexpected T_VARIABLE, expecting ']' in www\hyps\allocation_map.php on line 24

so, my question to you is, how do I have the variable $a inside of the _POST variable?
__________________
I wonder...
Outer is offline  
Old 02-23-2005, 07:45 PM   #2 (permalink)
NamePros Regular
Join Date: Jun 2003
Location: Louisiana, USA
Posts: 658
painperdu has a spectacular aura aboutpainperdu has a spectacular aura about
 



Put single quotes around the post variable:
PHP Code:
$_POST['planet$a']; 
painperdu is offline  
Old 02-23-2005, 09:59 PM   #3 (permalink)
NamePros Regular
 
CreativeLogic's Avatar
Join Date: Sep 2003
Posts: 890
CreativeLogic has a spectacular aura aboutCreativeLogic has a spectacular aura about
 



To be honest the best way going about doing this would be to set the names to planet[] rather than planet1, ect. This will create an array of all the input and would make everything much easier to maintain.
__________________
Online Time Tracking :)
CreativeLogic is offline  
Old 02-24-2005, 09:06 PM THREAD STARTER               #4 (permalink)
NamePros Member
Join Date: Jan 2005
Location: Texas USA
Posts: 71
Outer is an unknown quantity at this point
 



ah, gotchya creative

i did it that way and it worked much better, thx
__________________
I wonder...
Outer is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 02:16 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger