Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
Harlequin
Forum Commoner
Posts: 51 Joined: Tue Sep 21, 2004 10:51 am
Location: UK
Post
by Harlequin » Mon Sep 27, 2004 7:58 am
Morning all.
I have a fairly simple form that presents results from a table in text fields.
A user can insert new values and click a submit button. But for some reason the submission isn't working.
Here's what I have:
Code: Select all
echo "<form method='POST' action='Events_Updated.php?EventID=$resultїEventID]'>";
echo "<input type='hidden' name='EventID value='$resultїEventID]'>";
I won't bore you with the rest but on the submission page I have this:
Code: Select all
// Update Database:
$UpdateDatabase = "UPDATE events SET
EventTime = '" . $_POSTї"EventTime"] . "',
EventDate = '" . $_POSTї"EventDate"] . "',
EventBooked = '" . $_POSTї"EventBooked"] . "',
EventSpeaker = '" . $_POSTї"EventSpeaker"] . "'
WHERE EventID = '" . $_POSTї"EventID"] . "'";
$Updated = mysql_query($UpdateDatabase) or die ("Error: " . mysql_error());
What am I missing...?
Jean-Yves
Forum Contributor
Posts: 148 Joined: Wed Jul 02, 2003 2:13 pm
Location: West Country, UK
Post
by Jean-Yves » Mon Sep 27, 2004 8:16 am
On your hidden field, you are missing a single quote after the name value. Try correcting that and see if it works.
Harlequin
Forum Commoner
Posts: 51 Joined: Tue Sep 21, 2004 10:51 am
Location: UK
Post
by Harlequin » Mon Sep 27, 2004 8:28 am
Thanks Jean-Yves
Couldn't see the wood for the trees...!
If I want to use the old PHP_Self to keep users on that page should I be using GET instead of POST in the update query then...?
mudkicker
Forum Contributor
Posts: 479 Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:
Post
by mudkicker » Mon Sep 27, 2004 8:29 am
btw, why do you use both methods i mean your form action is
'Events_Updated.php?EventID=$result[EventID]'
and then you post it with hidden field, too..
it's not necessary i think..
Harlequin
Forum Commoner
Posts: 51 Joined: Tue Sep 21, 2004 10:51 am
Location: UK
Post
by Harlequin » Mon Sep 27, 2004 8:41 am
Actually - you're right.
It's code I've been working on between other things so I guess some of the old stuff just kind of got left there.
Some of my older pages have more lines commented out than executed...!
Jean-Yves
Forum Contributor
Posts: 148 Joined: Wed Jul 02, 2003 2:13 pm
Location: West Country, UK
Post
by Jean-Yves » Mon Sep 27, 2004 9:11 am
Harlequin wrote: Thanks Jean-Yves
Couldn't see the wood for the trees...!
Been there, done that - many times! Even with colour syntax-highlighting
If I want to use the old PHP_Self to keep users on that page should I be using GET instead of POST in the update query then...?
I'm not sure that I understand - why would you want the PHP_SELF as part of the query?
Or do you mean that you want to call the update and return to the page that has the form? I confess that I just use the form's name, but I think that you can use $HTTP_REFERER to get the name of the calling page. However, this does not always seem to work for me, and is open to hacking apparently since it can be spoofed (I think - not an expert on this!)
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Sep 27, 2004 10:29 am
HTTP_REFERER should rarely be used, now-a-days, it often doesn't exist, or can easily be erroneous. Remember, it is information coming from the user, and the user's inputs cannot be trusted, ever.