Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


PHP Upload and $_POST

Posted on 2011-05-09
Medium Priority
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
  • 2
  • 2
LVL 16

Author Comment

ID: 35725129
BTW - the data in my hidden fields comes through fine in the HTML.
LVL 111

Accepted Solution

Ray Paseur earned 2000 total points
ID: 35725249
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 111

Expert Comment

by:Ray Paseur
ID: 35725257
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

ID: 35725301
Thx...ill try soon

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

577 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