Re: help me please! :)

From: Date: Mon, 10 Jun 2002 09:03:59 +0000
Subject: Re: help me please! :)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-101375@lists.php.net to get a copy of this message
<?php $i = 1; $liv_1 = "one"; $liv_2 = "two"; $liv_3 = "three"; $liv_4 = "four"; $liv_5 = "five"; while ($i <= 5 ) { $do = "echo \$liv_{$i};"; eval($do); echo "<br>"; $i ++; } ?> Simply echoing the \$liv_$i will not work, need to evaluate the string after parsed as in example above... Kevin Porter wrote:
You need to escape the dollar sign with a backslash to prevent PHP trying to interpolate the variable $liv (which presumably doesn't exist). echo "\$liv_$i"; HTH, - Kev
-----Original Message----- From: Veronica Ghezzi [SMTP:veronica.ghezzi@lucense.it] Sent: 10 June 2002 09:24 To: Php-General Subject: [PHP] help me please! :) Hi, i must get the information saved in a several select list named
	liv_1             <select name="liv_1">
liv_2 <select name="liv_2"> liv_3 <select name="liv_3"> .... liv_n <select name="liv_n"> To get the value i work in this way... $n = 50; for ($i=1; $i<=$n;i++){ ...
		echo "$liv_$i";      //// in asp i do:   response.write
(request("liv_" + i)) ... } But i get only 1 2 3 ... 50 What can i do to get "$liv_1" ... "$liv_2"... ??? Thank you a lot! Veronica Ghezzi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. **********************************************************************


« previous php.general (#101375) next »