PHP Upload and $_POST

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

LVL 16
Who is Participating?
Ray PaseurCommented:
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.
carsRSTAuthor Commented:
BTW - the data in my hidden fields comes through fine in the HTML.
Ray PaseurCommented:
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
carsRSTAuthor Commented:
Thx...ill try soon
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.