Peki, ben bu HTML gibi bir sayfası var:
<form method="post" action="" enctype="multipart/form-data">
<!-- Some more markup -->
<form method="post" action="" enctype="multipart/form-data">
<input type="submit"name="reset_ph" value="<?php _e('Reset styles'); ?>" />
<input type="hidden" name="subaction" value="reset_ph" />
</form>
<p><input name="update" type="submit" value="<?php _e('Save changes'); ?>" style="padding:3px;" /></p>
<input type="hidden" name="action" value="update" />
</form>
Sonra PHP kodu:
//updating main form
if(isset($_FILES['phtfile']['name']) && $_REQUEST['action']=='update'){
$def_path = TEMPLATEPATH.'/img/author/';
$file_path = $def_path.basename($_FILES['phtfile']['name']);
$file_path = str_replace('\\','/',$file_path);
$file_css_path = get_bloginfo('template_url');
$file_css_path = $file_css_path.'/img/author/'.basename($_FILES['phtfile']['name']);
$isfile = move_uploaded_file($_FILES['phtfile']['tmp_name'],$file_path);
if ($isfile) { update_option('own_pht_url', $file_css_path);}
}
//update subform
if ($_POST['subaction']=='reset_ph'){
global $photo_path;
update_option('own_pht_url', $photo_path.'tmp.jpg');
}
Form (varsayılan görüntüye yol ayarı ile) birini varsayılan gösterilen görüntüyü sıfırlar bir düğme içerir. Ana form resim yükleme diyaloğu içerir ve bir yenisine görüntü için yolunu değiştirmek gerekir, dosya tarih olmalıdır. Ancak ana formu güncelleyerek, alt form günceller ve yol varsayılan olarak ayarlanır.
Ben bir onay kutusu için düğmeye değiştirerek, geçici bir çözüm düşündüm, ama ben yine de ilgileniyorum, ana formu her zaman bunun içinde her alt formu günceller güncelleme nedir? Çevresinde hiçbir yolu?
Zaman ayırdığınız için teşekkür ederiz.