Jump to content

[SOLVED] hidden field dont get posted with function


StefanRSA

Recommended Posts

I wrote a js function and am trying to $_Post the value of a hidden field to a form.

The function do fire of the php in the background but my hidden field value does not go thru... Can anybody help?

 

(I know this is partly JS and PHP but I get no help in the JS forums)

 

function deleteFileUpload(upload_field){
// Checking file type
var filename = document.pictureForm.delimage1.value;
document.getElementById('picture_preview').innerHTML = '<div><img src="../images/loader_light_blue.gif" border="0" /></div>';
upload_field.form.action = 'imagedelete.php';
upload_field.form.target = 'upload_iframe';
upload_field.form.submit();
upload_field.form.action = '';
upload_field.form.target = '';
return true;
}

My hidden field with submit button is:

<input type=\"hidden\" id=\"delimage1\" value=\"$dbimgname\" name=\"delimage1\"/><input type=\"submit\" value=\"Delete Image\" onClick=\"return deleteFileUpload(this);\">

 

The "imagedelete.php" form looks as follow:

<?PHP

$deleteimage = $_POST['filename'];
$filename = "../ad_images/$deleteimage";
$filename1 = "../ad_images/130/$deleteimage";
$filename2 = "../ad_images/65/$deleteimage";
unlink($filename);
unlink($filename1);
unlink($filename2);

// This is a PHP code outputing Javascript code.
echo '<script language="JavaScript" type="text/javascript">'."\n";
echo 'var parDoc = window.parent.document;';

$deletebutton = '';
echo "parDoc.getElementById('picture_error').innerHTML = '<input type=\"file\" name=\"img1\" id=\"picture\" onchange=\"return ajaxFileUpload(this);\" />';";
if($dbimgname = '') {
echo "parDoc.getElementById('picture_preview').innerHTML = '';";
}

echo "\n".'</script>';
exit(); // do not go futher

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.