Re: Passing array to form

From: Date: Sat, 26 Apr 2003 20:01:23 +0000
Subject: Re: Passing array to form
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-145377@lists.php.net to get a copy of this message
That worked perfectly! Thanks. "Ernest E Vogelsinger" <ernest@vogelsinger.at> wrote in message news:5.2.0.9.2.20030425163139.04243dc0@mail.vogelsinger.at... > At 17:25 25.04.2003, GeneralX spoke out and said: > --------------------[snip]-------------------- > >I can't seem to get the array in form to work, could use your help, thanks. > > > >1st file name: var_form.inc > >--------------------------- > ><? > >$forminfo = <<<EOD > ><form method="POST" action="$PHP_SELF"> > >........ > ><input type="text" name="userEdit[FName]" > >value="$userEdit[FName]" > >size="20"> > ><input type="text" name="userEdit[LName]" > >value="$userEdit[LName]" > >size="20"> > >........ > >EOD; > >?> > --------------------[snip]-------------------- > > Within double-quoted strings (this is valid for heredoc as well) you need > to put the array deref's between curly quotes. Note that I have > single-quoted the array keys so PHP will not look for defined constants. > > This example will work: > > $forminfo = <<<EOD > <form method="POST" action="$PHP_SELF"> > ........ > <input type="text" name="{userEdit['FName']}" > value="{$userEdit['FName']}" > size="20"> > <input type="text" name="{userEdit['LName']}" > value="{$userEdit['LName']}" > size="20"> > ........ > EOD; > > > -- > >O Ernest E. Vogelsinger > (\) ICQ #13394035 > ^ http://www.vogelsinger.at/ >

« previous php.general (#145377) next »