Reply to topic
Creating variable names on the fly
cheryl


Joined: 17 Apr 2004
Posts: 84
Location: Newark, DE
Reply with quote
I was recently writing an administrative script for one of the Professors at UDel to enter a bunch of students grades into a MySQL database so they can view their grades on the web. One thing that I found about PHP that was awesome was how easily you can dynamically create variable names. Since the Professor was entering everything on one page, my action page had a loop that pulled in each value. Rather than using an array, I was able to easily create variable names, such as student$id
which was so much easier than perl or Java, where I would have had to use concatentation to create the variable names before actually assigning values to them! Has anyone done anything similar to this before?
byron
Forum Admin

Joined: 07 Mar 2004
Posts: 160
Location: Newark, DE, USA
Reply with quote
You can do this real easy in CF as well, setVariable("myStudent#theID#", value)....

evaluation is very easy as well,

evaluate("form.myStudent#theID#")
Creating variable names on the fly
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic