Re: When form doesn't know what it's sending

From: Date: Sat, 10 Mar 2001 01:12:16 +0000
Subject: Re: When form doesn't know what it's sending
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-43262@lists.php.net to get a copy of this message
> i've concatenated a string from a while statement on a SQL query. example: > "$mars","$venus","$jupiter". let's say i call this $planets. > there are actual variables from a posted form with those names. say, > $mars=1, $venus=2, $jupiter=3. however, when i echo "$planets" i get the > string "$mars,"$venus"... rather than what I want: > "1," "2", "3". but if echo $mars i get "1." i'm > trying to create a dynamic > sql insert statement because the page sending it doesn't know what/how many > varialbes it's sending. if i hard code it, it works. this has been puzzling > me for days! see, the 'planets' are all displayed on the form from the > while statement to database table1. i.e. while (...results) > $name=row[(planets)]....the other variables in the form are defined. say, > $number. the statement/string reads them okay. i.e. if string/statement was > ("\"$number\",\"$mars\",\"venus\") it will echo as > ("54","$mars","$venus.....). have i made my problem clear? because > it's > sure confusing me! If you have "$mars,$venus,$jupiter" and you want PHP to substitute for the variables, maybe you could use http://php.net/eval However, I suspect you are doing something way more complicated than you need to in the first place, which has gotten you in this predicament. What is the original task? -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#43262) next »