Get data from dropdown and update page

How about this: <?php $arr = [“Cat”, “Dog”, “Cow” ]; if( $_POST[‘animal’]){ $animal=$_POST[‘animal’]; echo $animal; } ?> <form name=”f” id=”a” method=”post” action=””> <select id=”animal” name=”animal” onchange=”this.form.submit()” > <option value=”0″>–Select Animal–</option> <?php foreach ($arr as $a){ if($a == $animal){ echo “<option value=”{$a}” selected >$a</option>”; }else{ echo “<option value=”{$a}” >$a</option>”; } } ?> </select> </form> Note you … Read more

stackexchange-like submit comment window

You can use WordPress’s built in TinyMCE editor anywhere in PHP code using wp_editor(). This would output all the necessary styles and scripts for it to load, and there are a lot of options documented in the codex link above.

Admin page: form with enctype=”multipart/form-data” does not transfer its data

If you want to upload in a custom folder you can use the following function. Add the function in functions.php function upload_user_file( $file = array(),$path ) { if(!empty($file)) { $upload_dir=$path; $uploaded=move_uploaded_file($file[‘tmp_name’], $upload_dir.$file[‘name’]); if($uploaded) { echo “uploaded successfully “; }else { echo “some error in upload ” ;print_r($file[‘error’]); } } } Make a form in your … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)