Wade,

Is the variable table_name you're passing an array? If so, you would want
to do something more like this:

$array = $_POST['table_name'];

foreach ($array as $table) {
        $sql = "CREATE TABLE ".$table."(";
                for($i = 0; $i < count($field_name); $i++)
                ///etc etc etc
}

If $_POST['table_name'] is not a variable (how are you passing more than
one name in it then?!?), you'll have to split it up however.

>From my experience, if you try to use the $_POST, $_GET, $_etc variables
in double quotes, it won't work. That's why I use the
".$_POST['varname']." trick. Don't forget to put the array name in single
(or double) quotes. $_POST[varname] will give you an undefined constant
error.

-Dash

On Wed, 12 Feb 2003, Wade wrote:

> 02122003 1252 GMT-6
>
> Ok. This might be a different problem than I first thought.
> Im calling data from the previous page via the $_POST. This holding
> variable is holding eight or more values. It takes these values and
> creates fields for a database.
>
> My problem is, does this code pull multple values from the POST variable?
>
> $sql = "CREATE TABLE $_POST[table_name](";
>               for($i = 0; $i < count($field_name); $i++)
>
> wade
>
>
> Wade wrote:
> > 02122003 1224 GMT-6
> >
> > I have a question. When escaping characters, on the $_POST{x} do you
> > need to escape this as well? This is a snippt of code but Im getting a
> > Parse T error.
> >
> > $form_block = "
> >         <form method = \"POST\" action = \"db_createtable.php\">
> >         <input type = \"hidden\" name = \"$_POST[table_name]\" value =
> > \"$_POST[table_name]\">
> >
> > Wade
> >
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to