GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 25-Oct-2004, 05:30
dopee dopee is offline
Awaiting Email Confirmation
 
Join Date: Feb 2004
Location: south africa
Posts: 109
dopee will become famous soon enough

making string data into a variable


OK so this quite a comfusing one lemme try set the situation:
I am trying to create a loop to define a string variable that will be used to specify the filename of a file for upload. In the script i'm using, the files in the form are specified as file_name; file2_name; file3_name etc etc to be able to upload multiple files. So the text i'm generating is file_name etc.
Take a look at my example code:

PHP Code:

$fileuploads=3;

for ($filecounter = 1; $filecounter <= $fileuploads; $filecounter++)
{
      if ($filecounter == 1)
      $whichfile = "\$file_name";
      else $whichfile = "\$file".$filecounter."_name";
} 



now the $whichfile variable is assigned: $file_name; $file2_name; $file3_name to be able to upload the 3 files one at a time (within the loop). My only problem is now when I try to see if the file exists IE if ($file_name) it check the contents of the $whichfile varaible instead of the contents of the contents of the $whichfile variable. In other words, if the content of $whichfile is "$file_upload", how do I use the "$file_upload" as a variable instead of string data?

IE if the contents of $whichfile is $file_name
and I say:
if ($whichfile)

I want it to check if $file_name exists and not $whicfile...
Any ideas is this even possible to fix...quite a mindjam.
 
 

Recent GIDBlogProblems with the Navy (Chiefs) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Read a .html file, check that file for links salemite C Programming Language 10 17-Jan-2008 08:56
Get value for variable name defined as string mirizar C Programming Language 3 21-Jun-2004 18:36
[CONTEST?]Data Structure Test dsmith C Programming Language 2 06-Jun-2004 16:13

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 01:34.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.