error in <form action='{$_SERVER['PHP_SELF']}
Hello,
I'm confused how to send value of hidden field in form which post to itself.
I redirect from transact-article.php to upload.php with following info: redirect('upload.php?article=' . $artid);
in upload.php I have these code lines:
...
$article = $_GET['article'];
...
if (!isset($_POST['do_action'])){
echo " <form action='{$_SERVER['PHP_SELF']}' method='post' enctype='multipart/form-data'>\n",
<input type='file' name='userfile'>\n";
<input type='hidden' name='artic' value='{$article}' />\n",
</form>
...
//input file name and artcile id into db
$sql = "INSERT INTO uploads " .
"(research_data_id, filename)" .
"VALUES ('" . $_POST['artic']. "', '" . trim($file_path) . "')";
This code give an error of undefined index in line
$article = $_GET['article'];
I tried to change it to $_POST, didn't help. I need this line when I get article id from file
transact-article.php with redirect('upload.php?article=' . $artid);
Could you please help me to solve the problem with Undefined index: article?
And also, there is another big problem: when I upload second file to same article( I call upload.php again) the article id is not resent, how can I submit it to upload.php again? I though the hidden field should do the work, but, probably I don't call it properly..
Please, help
Thank you,
|