tags:

views:

58

answers:

1

Hi All: PHP : I am trying to upload a file using php,and i need to pass a value like id or some thing with the from the upload form page to the file that have php code plz look at this code:

<form  name = "file" enctype="multipart/form-data" action="uploadpp.php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type=button name="Submit" value="Submit" />
</form>

can i send the value with the same post array?? thanks in advance.

+2  A: 

You can use hidden form fields:

<input type="hidden" name="foo" value="bar" />

So in PHP, $_POST['foo'] would give you "bar"

Alternatively you can add them as "GET parameters" into the form's action attribute:

<form ... action="uploadpp.php?foo=bar" ...>

And access that with $_GET['foo']

intgr
I'd recommend using $_POST, as you do not want anyone bookmarking your generated link.
DanDan
I didlike this :<input type="hidden" name="foo" value=<?echo($_GET["pro_id"]);?> />but it didnt work
3bd
Well it should work; what HTML are you seeing in the browser?Also, to avoid cross-site scripting flaws, you should use:`<input type="hidden" name="foo" value="<?php echo htmlspecialchars($_GET["pro_id"]);?>" />`
intgr
thanks man that worked
3bd