Re: Variable post as array
| From: | Pieter du Toit | Date: | Wed, 05 Mar 2008 10:37:33 +0000 |
| Subject: | Re: Variable post as array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-270999@lists.php.net to get a copy of this message | ||
Just to add, if i try to echo the $_FILES['txtPhoto']['temp_name'] it tells
me that temp_name is also an array, but when i echo
$_FILES['txtPhoto']['name'] it gives me the correct name. Also with a
vardump i can see that temp name is ["tmp_name"]=> string(14)
"/tmp/phplR1WSl" and not an array by itself.
Im going crazy here
""Pieter du Toit"" <pieter@lpwebdesign.co.za> wrote in message
news:E7.13.27925.EDE6EC74@pb1.pair.com...
> Hi
>
> I have this weird problem, when i select a file to upload, the variable
> arrives as an array at the action php file, this is the code, and the
> variable name is txtPhoto
>
> <? include ("userpass.inc"); ?>
>
> <html>
>
> <link rel="STYLESHEET" type="TEXT/CSS" href="specials.css">
>
> <title>Specials Update</title>
>
> </head>
>
> <? include ("body_begin.inc"); ?>
>
> <?
>
> echo "<form ENCTYPE=\"multipart/form-data\" method=\"POST\"
> name=\"Edit
> Special\" action=\"specials_proc.php\">\n";
>
> echo "<input type=\"hidden\" name=\"keyClient_Id\"
> value=\"$g_client_id\">";
>
> echo "<input type=\"hidden\" name=\"keySpecial\"
> value=\"$special\">";
>
> echo "<input type=\"hidden\" name=\"k_subsystem_id\"
> value=\"$k_subsystem_id\">";
>
> echo "<table align=\"center\" class=\"EditView\"
> border=\"0\"
> cellspacing=\"0\" cellpadding=\"0\" width=\"80%\">\n";
>
>
>
> if ($special != "")
>
> {
>
> $new = 0;
>
> echo "<tr class=\"MainHeader\"><th colspan=\"2\">Edit
> Special</th></tr>\n";
>
> $result = mysql("zululandcoza", "select * from client_specials where
> client_id = $g_client_id and special = $special");
>
> if (list($client_id, $special, $description, $special_type, $price,
> $discount, $startdate, $enddate) = mysql_fetch_row($result))
>
> {
>
> }
>
> }
>
> else
>
> {
>
> $new = 1;
>
> echo "<tr class=\"Header\"><th colspan=\"2\"><h1>New
> Special (this page is
> undergoing maintenance, please try again later)</h1></th></tr>\n";
>
> $result = mysql("zululandcoza", "select max(special) from client_specials
> where client_id = $client_id");
>
> if (list($max_special) = mysql_fetch_row($result))
>
> {
>
> $special = $max_special + 1;
>
> }
>
> }
>
>
>
> echo "<tr class=\"Update\">\n";
>
> echo " <td align=\"left\"
> class=\"Prompt\">Special Number</td>\n";
>
> if ($new)
>
> echo " <td align=\"left\" class=\"Number\"><input
> type=\"text\"
> name=\"txtSpecial\" maxlength=\"5\" size=\"5\"
> value=\"$special\"></input></td>\n";
>
> else
>
> echo " <td align=\"left\" class=\"Number\"><input
> type=\"text\"
> name=\"txtSpecial\" maxlength=\"5\" size=\"5\"
> value=\"$special\"
> enabled=\"0\"></input></td>\n";
>
> echo "</tr>\n";
>
> echo "<tr class=\"Update\">\n";
>
> echo " <td align=\"left\"
> class=\"Prompt\">Description</td>\n";
>
> echo " <td align=\"left\" class=\"Text\"><input
> type=\"text\"
> name=\"txtDescription\" maxlength=\"200\" size=\"50\"
> value=\"$description\"></input></td>\n";
>
> echo "</tr>\n";
>
> echo "<tr class=\"Update\">\n";
>
> echo " <td align=\"left\"
> class=\"Prompt\">Special Type</td>\n";
>
> echo " <td align=\"left\" class=\"Selection\">\n";
>
> $optPRICE = "";
>
> $optDISC = "";
>
> $optFROM = "";
>
> if ($special_type == "FROM")
>
> $optFROM = " SELECTED";
>
> elseif ($special_type == "DISC")
>
> $optDISC = " SELECTED";
>
> else
>
> $optPRICE = " SELECTED";
>
> echo " <select name=\"cbxSpecial_Type\">\n";
>
> echo " <option value=\"PRICE\"$optPRICE>Special
> Price</option>\n";
>
> echo " <option value=\"DISC\"$optDISC>Discount %</option>\n";
>
> echo " <option value=\"FROM\"$optFROM>From</option>\n";
>
> echo " </select>\n";
>
> echo " </td>\n";
>
> echo "</tr>\n";
>
> echo "<tr class=\"Update\">\n";
>
> echo " <td align=\"left\"
> class=\"Prompt\">Price</td>\n";
>
> echo " <td align=\"left\" class=\"Currency\"><input
> type=\"text\"
> name=\"txtPrice\" maxlength=\"20\" size=\"10\"
> value=\"$price\"></input></td>\n";
>
> echo "</tr>\n";
>
> if ($k_subsystem_id == 2)
>
> {
>
> if (! $new)
>
> {
>
> echo "<tr class=\"Update\">\n";
>
> echo " <td align=\"left\" class=\"Prompt\">Current
> Photo</td>\n";
>
> echo " <td align=\"left\" class=\"Currency\"><img
>
> src=\"showpic.php?keySystem_Id=2&keyClient_Id=$g_client_id&keySpecial=$special\"></td>\n";
>
> echo "</tr>\n";
>
> }
>
> echo "<tr class=\"Update\">\n";
>
> echo " <td align=\"left\" class=\"Prompt\">New
> Photo</td>\n";
>
> echo " <td align=\"left\" class=\"Currency\"><input
> type=\"file\"
> name=\"txtPhoto\" size=\"50\"></input></td>\n";
>
> echo "</tr>\n";
>
> }
>
> echo "<tr class=\"Footer\">\n";
>
> echo " <td colspan=\"2\">\n";
>
> if ($new)
>
> {
>
> echo " <input type=\"submit\" name=\"cmdAdd\"
> value=\"Add\"> \n";
>
> }
>
> else
>
> {
>
> echo " <input type=\"submit\" name=\"cmdUpdate\"
> value=\"Update\"> \n";
>
> echo " <input type=\"submit\" name=\"cmdDelete\"
> value=\"Delete\"> \n";
>
> }
>
> echo " <input type=\"submit\" name=\"cmdCancel\"
> value=\"Cancel\">\n";
>
> echo " </td>\n";
>
> echo "</tr>\n";
>
> echo "</table>\n";
>
> echo "</form>\n";
>
> ?>
>
>
>
> <? include ("body_end.inc"); ?>
>
> </html>
>
>
>
>
>
>