It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum

php problem in for loop

Moderator: Malcolm

php problem in for loop

Postby john_zakaria on Mon Apr 06, 2009 9:24 am

hi everyone please i want to print the value of the variables
$myradiobutton1
$myradiobutton2
$myradiobutton3
$myradiobutton4
....... $myradiobutton10

i made a for loop to print the values of each $myradiobutton($i)
but i can not print it ...
can anyone help me

the code is
Code: Select all

for($i = 1; $i < 11; $i++)
             {         
   
     echo $myradiobutton.$i.'<Br><BR>';
      
   }


please try to fix this problem
thnx in advance
john_zakaria
50+ Club
 
Posts: 60
Joined: Sun Feb 08, 2009 7:29 am

Re: php problem in for loop

Postby rangana on Wed Apr 08, 2009 7:01 am

Change this part:
Code: Select all
echo $myradiobutton.$i.'<Br><BR>';


to:
Code: Select all
echo ${'myradiobutton'.$i}.'<Br><BR>'; 


Hope that helps.
Last edited by rangana on Wed Apr 08, 2009 7:12 am, edited 1 time in total.
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines

Re: php problem in for loop

Postby Suffer on Wed Apr 08, 2009 7:08 am

yes it help. I have similar problem some time ago.
Suffer
100+ Club
 
Posts: 236
Joined: Tue Jan 20, 2009 6:34 am


Who is online

Users browsing this forum: No registered users and 0 guests