Re: Passing Array to Form
| From: | Squirrel User | Date: | Sun, 20 Apr 2003 18:49:50 +0000 |
| Subject: | Re: Passing Array to Form | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27197@lists.php.net to get a copy of this message | ||
I tried it but didn't work. I got the form in an include file such as below:
file: var_form.inc
------------------
<?
$forminfo = <<<EOD
<form method="POST" action="$PHP_SELF">
...
...
<input type="text" name="{$userEdit[FName]}" size="20">
<input type="text" name="{$userEdit[LName]}" size="20">
...
...
EOD;
?>
file: form.php
--------------
<?
$userEdit[FName] = "John";
$userEdit[LName] = "Williams";
...
include "var_form.inc";
echo $forminfo;
?>
Quoting heilo <grillen@abendstille.at>:
> Hi!
>
> Try this:
>
>
> <<<EOD
> <form method="post" action="$PHP_SELF">
> <input type="text" name="{$userEdit[FName]}" size="20">
> <input type="text" name="{$userEdit[LName]}" size="20">
> </form>
> EOD;
>
> Anyways - i propose to do it this way - well i do it this way because of
> the
> syntax-higlighting (so i can properly distinguish between html-output and
> phpcode) - but this is only a proposal ;)
>
> $userEdit['FName'] = "John";
> $userEdit['LName'] = "Williams";
> echo '<form method="post"
> action="'.$PHP_SELF.'">'."\n".
> ' <input type="text" '.
> 'name="'.$userEdit['FName'].'" '.
> 'size="20">'."\n".
> ' <input type="text" '.
> 'name="'.$userEdit['LName'].'" '.
> 'size="20">'."\n".
> '</form>'."\n";
>
>
> .ma
>
> Squirrel User <squirrel@isot.com> wrote@20.04.2003 0:13 Uhr:
>
> > I've read the user info from database and trying to edit the info using a
> > form. But I can't seem to pass the array values to the form using method
> > below. But it does work if I use non array variable. Any idea?
> >
> >
> > $userEdit[FName] = "John";
> > $userEdit[LName] = "Williams";
> > ...
> > $forminfo = <<<EOD
> > <form method="POST" action="$PHP_SELF">
> > ...
> > ...
> > <input type="text" name="$userEdit[FName]" size="20">
> > <input type="text" name="$userEdit[LName]" size="20">
> > ...
> > ...
> > EOD;
> >
> >
> >
> > -------------------------------------------------
> > This mail sent through ISOT. To find out more
> > about ISOT, visit http://isot.com
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
-------------------------------------------------
This mail sent through ISOT. To find out more
about ISOT, visit http://isot.com