Re: $_POST not always set?
From: Adrian Parker (adrian.parker_at_NOSPAMsympatico.ca)
Date: 04/29/04
- Next message: Adrian Parker: "Re: Handling Multiple check boxes"
- Previous message: Adrian Parker: "Re: PHP INSERT Bad data"
- In reply to: Adrian Parker: "$_POST not always set?"
- Next in thread: Jan Pieter Kunst: "Re: $_POST not always set?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 29 Apr 2004 15:48:37 -0400
"Adrian Parker" <adrian.parker@NOSPAMsympatico.ca> wrote in message
news:ZHckc.41850$OU.975473@news20.bellglobal.com...
> Is it possible to click on a button, and not have it's value and name
stored
> in _POST?
>
> I have this script with a button on it. When you click the button, the
page
> posts to itself. The first time you click this Save Changes button, _POST
> is empty. After clicking the button, and the page is loaded again, if you
> click Save Changes once more the _POST is properly set. What's up with
> that?
Methinks my problem comes about when I try to force data into _POST.
method="post?action=....
Is there a solution to this?
Adrian
>
>
>
> $studentCode; // Will hold the current student code, if applicable
>
> ...
>
> foreach(array_keys($_POST) as $key)
> {
> $$key = $_POST[$key];
> print "$key is ${$key}<br />";
> echo "It is: " . $_POST["Submit"] . "<br>";
> }
>
>
> if ($_POST["Submit"] == "Add Student") // Save button was hit
> addRecord();
> elseif ($_POST["Submit"] == "Save Changes") // Save changes button was
hit
> updateStudent();
> echo "We're saving changes<br>";
> elseif ($_GET["action"] != "add")
> getOldData($record);
>
>
>
> echo "<table summary=\"\" cellpadding=\"5\">";
>
> function printLabelCell()
> {
> echo "\n<tr><td align=\"right\">";
> }
>
> if (isset($_GET["studentCode"]))
> $studentCode = $_GET["studentCode"];
> elseif (isset($_POST["studentCode"]))
> $studentCode = $_POST["studentCode"];
>
> if ($studentCode != "")
> $postType = "post?studentCode=" . $studentCode;
> else
> $postType = "post";
>
> echo '<form action="addEditStudent.php" method="' . $postType . '">';
>
> // ... print controls in the cells ...
>
> echo "<tr><td colspan=\"2\" align=\"center\">";
>
> echo '<br>';
>
> if ($_GET["action"] == "add" or isset($_POST["firstName"]))
> echo '<input type="Submit" name="Submit" value="Add Student">
> ';
> else
> echo '<input type="Submit" name="Submit" value="Save Changes">';
>
> echo ' <input type="Reset" name="Reset" value="Clear
> Data"><br><br>';
>
> echo "</td></tr></table>";
>
> echo "</form>";
>
> function DisplayTextbox($vname, $size, $value)
> {
> echo "</td><td><Input type=\"text\" name = \"" . $vname . "\" Size =
\""
> . $size . "\" value=\"" . $value . "\"></td></tr>";
> }
>
> mysql_close($link);
>
>
> ...
>
>
>
> <Ade
> --
> Adrian Parker. Ordained priest. <adrian.parker@sympatico.ca>
>
> "A society that views graphic violence as entertainment ...should not be
> surprised when senseless violence shatters the dreams of it's youngest and
> brightest..." - Ensign (March 2004)
>
>
- Next message: Adrian Parker: "Re: Handling Multiple check boxes"
- Previous message: Adrian Parker: "Re: PHP INSERT Bad data"
- In reply to: Adrian Parker: "$_POST not always set?"
- Next in thread: Jan Pieter Kunst: "Re: $_POST not always set?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]