Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if(!isset ($_POST['invia'])){ ?>
- <form id="firstimg" method="POST">
- <div class="module_content">
- <fieldset>
- <label>Seleziona articolo</label>
- <select for="article">
- <option value="" disabled="disabled" selected="selected">-</option>
- <?php
- $res=mysql_query("SELECT post_title FROM wp_posts WHERE post_status='publish' AND post_type='post' ORDER BY post_date DESC");
- if($res && mysql_num_rows($res)>0){
- while($row=mysql_fetch_assoc($res)){
- $titolo=$row['post_title'].""; ?>
- <option value="<?php echo $titolo; ?>"><?php echo $titolo; ?></option>
- <?php }
- } else { ?>
- <option value="" disabled='disabled'>Errore Connessione</option>
- <?php } ?>
- </select>
- </fieldset>
- <fieldset>
- <label>URL Immagine</label>
- <input type="text" name="img" id="img">
- </fieldset><div class="clear"></div>
- </div>
- <footer>
- <div class="submit_link">
- <input type="submit" name="invia" id="invia" value="Invia" class="alt_btn">
- </div>
- </footer>
- </form>
- <?php
- } else { ?>
- <div class="module_content">
- <fieldset>
- <?php
- $article = mysql_real_escape_string($_POST['article']);
- $img = mysql_real_escape_string($_POST['img']);
- if($article == "" || $img == ""){
- echo "Devi riempire tutti i campi";
- } else {
- $inviaimg=mysql_query("INSERT INTO wp_posts (post_firstimg) VALUES ('$img') WHERE post_title='$article'");
- if($inviaimg){
- echo "Immagine caricata";
- } else {
- echo "Caricamento fallito";
- }
- } ?>
- </fieldset>
- </div>
- <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement