Re: Forms
| From: | Cal Evans | Date: | Tue, 06 May 2003 13:12:25 +0000 |
| Subject: | Re: Forms | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146514@lists.php.net to get a copy of this message | ||
C.R.
Since you are dumping EVERYTHING that comes in form the form into your
database, it would be helpful for you to see what is coming in. try this,
somewhere in your code, before your insert do this:
echo "<PRE>";
var_dump($_POST);
That's what it's trying to dump into your database.
I suggest that you not use the for loop to load your query. It may be easy
but it is prone to these hidden errors and it's also a way that a malicious
person can disrupt your server. (What you think only your forms can be
posted to your server?)
HTH,
=C=
* Cal Evans
* http://www.christianperformer.com
* Stay plugged into your audience
* The measure of a programmer is not the number of lines of code he writes
but the number of lines he does not have to write.
*
----- Original Message -----
From: "C.R." <odcs@rogers.com>
To: "PHP General" <php-general@lists.php.net>
Sent: Wednesday, May 07, 2003 12:22 AM
Subject: [PHP] Forms
> I'm trying to use an image as a submit button in a form and getting some
> stupid error I just can't figure out. I have four seperate forms on my
site
> and 3 of them work and one doesn't. I have copied and pasted the input
line
> so they are the same in all four, so I am at a loss.
>
> This is the line....
>
> <INPUT TYPE="image" src="images/arrow-r.gif" width="56"
> height="24"
> border="0">
>
> but .....this will work.
>
> <INPUT TYPE="submit" value="Submit">
>
> This is being sent to a PHP script which will then write the form info to
a
> MySQL database - the error I am getting is this:
>
> Unknown column 'x' in 'field list'.
>
> So where is it getting the column 'x' from?
>
> This is the top of the form on all four forms (other than the ACTION = and
> FORM NAME).
>
> <FORM NAME="Update Profile" Target"contentFrame"
> ACTION="editcheck.php"
> METHOD="POST" CLASS="formstyle">
>
> The only thing I can think of that is causing the problem is the
following,
> but I have no idea why. Any help is appreciated.
>
> $query = "UPDATE $userinfotable SET ";
> foreach($_POST as $field=>$value) {
> $upfields[] = "$field='$value'";
> }
> $sqlfields = implode($upfields,",");
> $query .= $sqlfields. " WHERE userid = '$userid'";
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>