You are here: Re: How to use iteration to rename $_POST variables? « PHP « IT news, forums, messages
Re: How to use iteration to rename $_POST variables?

Posted by J.O. Aho on 02/14/06 19:43

Joe wrote:
> I'm trying to find a solution for what is probably a very simple
> problem for an experienced PHP programmer.
>
> We are trying to move over a schedule to a web form. I think I am doing
> pretty well getting things together, tying it into a MySQL db and such,
> but the killer is that there are about 500 text area global variables
> that need to come from the entry form to the script for processing.
>
> So, I have about 500 $_POST['Shift_001'] (where 001 becomes 002,
> 003...478) variables that I need to place into a table after they've
> been filed out in the originating form. I've been able to pretty easily
> create the original form with iterations of the Shift suffix, but I'm
> just floundering trying to put together a way to use an iteration -- or
> any sort of 'automation' -- to write this $_POST['Shift_$i'] on the
> fly as TD in a new Table.

Try with $_POST["Shift_$i"]

if you use single quotes '' the string inside will be exactly as you typed it.

if you use double quotes "" the string will convert variables to the value
they contains. eg
$var="Something"
echo "$var\n"; //result: Something
echo '$var\n'; //result: $var



//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация