PHP Upload and $_POST

Posted on 2011-05-09
Last Modified: 2012-05-11
I have a form upload which works fine.  However, my hidden variables don't seem to make it, and I'm not sure exactly why.  Below is my form and part of the PHP code:

<form action="upload.php" method="post" id="form" enctype="multipart/form-data">	
	<input name="file" id="file2" type="file"/>

	<input type="submit" id="upload" value="Upload" />
	<input type="hidden" id="username" value="<?echo($user->firstname) . " " . $user->lastname;?>" />
	<input type ="hidden" ID="ID" value="<? echo($new_order_initiation_ID);?>">
	<input type ="hidden" ID="date_fld" value="cube_date">
	<input type ="hidden" ID="per_fld" value="cube_by">

//##PHP FILE##

$date_fld = $_POST['date_fld'];  
$per_fld = $_POST['per_fld'];
$ID= $_POST['ID'];

Open in new window

Question by:carsRST
    LVL 16

    Author Comment

    BTW - the data in my hidden fields comes through fine in the HTML.
    LVL 107

    Accepted Solution

    There is no name= attribute on the hidden input controls.  Add that and you should be OK.  Use var_dump($_POST) to verify the new POST array.
    LVL 107

    Expert Comment

    by:Ray Paseur
    Also, save yourself some trouble going forward... Add error_reporting(E_ALL) to the top of all your scripts.  If you had that here you would have gotten a Notice message about the undefined index in $_POST.

    Best regards, ~Ray
    LVL 16

    Author Comment

    Thx...ill try soon

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now