carols - true, but to avoid confusion and problem sif your names get more complex (i.e. i think $$some_name will go crazy, you should always do it like this
$var_name = "game1"; ${$var_name} cheers guys // -----Original Message----- // From: Carlos Augusto Abarca [mailto:[EMAIL PROTECTED]] // Sent: Thursday, 25 October 2001 3:19 AM // To: [EMAIL PROTECTED] // Subject: [PHP-DB] Re: Newbie in Need of Assistance // // // It´s very easy and to tell you the truth I descovered it by accident: // // Lets say you have a variable with the dynamic variable name // (ej. $var_name = // "game1";) // // if you want to create this variable ($game1) then you can write: // $$var_name // And that´s it. // // try it. // // "Jmack" <[EMAIL PROTECTED]> escribió en el mensaje // [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... // > Greetings. I have been playing around with PHP this week, // programming a // > football pool. I have hit a small snag that I would like // some assistance // > with, if anyone knows the answer -- it's probably very // simple, but my // Intro // > to PHP book does not tell me how to do it. // > // > I have an HTML form in a PHP page, with several controls // on it. I am // > dynamically generating the names for these controls. Here is the // example -- // > for each game, the user selects the winner in a <SELECT> // control. It's // set // > up to not care how many games there are for each week, // just dynamically // > build the form/controls and name them "pick1", "pick2", etc. // > // > In my function that handles the form and uploads the // user's picks to the // > database (MySQL), I need to also dynamically generate the // variable names // > that refer to these controls. I have them all declared as global // variables, // > since I know there will never be more than 15 games in a // given week. But, // I // > want to iterate through a loop for each game and update // the database. As // I // > loop through for each game, and try to dynamically // generate the vaiable // > names for $pick1, $pick2, etc. I end up trying to update the DB by // sending // > in the string "$pick1" instead of the value from the form // control for // pick1. // > // > I have attached the PHP file in question. The code is not // very clean, // > especially the part where I am having problems, but // hopefully, someone // will // > have some time to help me with this problem. Please // respond to this // > newsgroup or directly to me at [EMAIL PROTECTED] Thank you. // > // > Joe Mack // > // > // > // > // // // // -- // PHP Database Mailing List (http://www.php.net/) // To unsubscribe, e-mail: [EMAIL PROTECTED] // For additional commands, e-mail: [EMAIL PROTECTED] // To contact the list administrators, e-mail: // [EMAIL PROTECTED] // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]