View Full Version : uploading a php file with set variables

06-19-2006, 02:39 PM
hi, i've been looking at php upload forms, but i'm still not sure how to do this... if its possible.

i have a list of records displayed in the admin section of a site. when you click an individual record, i need a php file to be uploaded (more added, than uploaded) in a specific location. the php file contains one variable that needs to be set dependant on a field in the record. so something like

list item 1 fieldvalue=1
list item 2 fieldvalue=2
list item 3 fieldvalue=3

click list item 1 and


blah blah blah




is uploaded to /admin/item$fieldvalue.php

i hope that makes sense, its kinda hard to explain. thanks for any help.

06-19-2006, 08:50 PM

and when you write the code you need to call the variables funny.


or else it will assume $varname is a local variable you are attempting to access.

you can also make this a function (although i don't see why you would need too)

print makeVar('varname','value');

function makeVar($n,$v)
$n=($n && strlen($n) > 0) ? $n : 'undefined';
$v=($v && strlen($v) > 0) ? $v : 'undefined';
return '$'.$n.'='.$v;

06-19-2006, 09:14 PM
or just put the $variables inside single-quotes...

06-19-2006, 09:16 PM
or just put the $variables inside single-quotes...
.... or that i guess... if you wanted to be fancey