MySQL Forums :: PHP :: Creating a variable variable name


Advanced Search

Creating a variable variable name
Posted by: Tom Carpenter ()
Date: November 20, 2010 08:44PM

I've read about variable variables and string concatenation and could use some advice on the best approach for an html form I'm working on.

When I generate the form I sometimes loop sections that repeat.

One such loop is like this:

Phone1 Description1
Phone2 Description2
Phone3 Description3

The table record actually has fields Phone1, Description1, Phone2, ...etc. and I equate them to $phone1, $description1, $phone2, etc.

What I tried to do was to use $i to control to loop and then echo:

value='$phone$i' or value '$description$i' in an <input> statement but that doesn't work.

Thanks

Tom

Options: ReplyQuote


Subject Written By Posted
Creating a variable variable name Tom Carpenter 11/20/2010 08:44PM
Re: Creating a variable variable name Rick James 11/22/2010 12:09AM
Re: Creating a variable variable name Tom Carpenter 11/24/2010 08:13AM
Re: Creating a variable variable name Barry Galbraith 11/24/2010 04:35PM
Re: Creating a variable variable name Tom Carpenter 11/25/2010 09:31AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.