Forums

Setting Post Title (15 posts)

  1. TonyNooblet
    Member
    Posted 2 years ago #

    Hi guys,

    So heres what I'm trying to do. I'm editing a plugin and in the submit video form (where admins sumbit a video) the plugin has an input title (for the post) field. What I'm trying to do is combing the category name (the plugin already has the input field for it) and another input field and set it as the title for the post.

    Can anyone guide me on how I would do this? Much appreciated if you could.

  2. TonyNooblet
    Member
    Posted 2 years ago #

    Someone help please?

  3. nazcar
    Member
    Posted 2 years ago #

    what is the code for the video title?
    just put them together inside a div title class..

  4. TonyNooblet
    Member
    Posted 2 years ago #

    I don't get you. The whole form code looks like this

    <form name="post" method="post">
    
    <div class="wrap">
    <div id="poststuff">
    <div id="post-body">
    
    <div class="postbox">
    <h3><label for="title">Name of Anime/Movie Category (i.e. Naruto, Bleach, One Piece):</label></h3>
    <div class="inside">
    <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'category', 'orderby' => 'id', 'hierarchical' => 1, 'tab_index' => 1 ) ); ?>
    </div>
    </div>
    
    <div class="postbox">
    <h3>Episode or Part: <small>(If Anime then TYPE "Episode 3", If Movie then TYPE "Part 1", ETC.)</small></h3>
    <div class="inside">
    <input type="text" name="partepisode" size="30" tabindex="2" value="<?php echo htmlspecialchars($_POST['partepisode']);?>" id="partepisode"  style="width: 98%;"/>
    </div>
    </div>
    
    <div class="postbox">
    <h3>Video Description:</h3>
    <div class="inside">
    <textarea id="description" tabindex="2" name="description" cols="40" rows="3" style="width: 98%;"/>
    <?php echo htmlspecialchars($_POST['description']);?>
    </textarea>
    </div>
    </div>
    
    <div class="postbox">
    <h3>Genres: <small>seperated by comma's</small></h3>
    <div class="inside">
    <input type="text" name="tags" size="30" tabindex="4" value="<?php echo htmlspecialchars($_POST['tags']);?>" id="tags"  style="width: 98%;"/>
    </div>
    </div>
    
    <div class="postbox">
    <h3>Thumbnail URL: <small> If you use Mozilla: Just RIGHT click the image and select "Copy Image Location" and paste here</small></h3>
    <div class="inside">
    <input type="text" name="thumb" size="30" tabindex="5" value="<?php echo htmlspecialchars($_POST['thumb']);?>" id="thumb"  style="width: 98%;"/>
    </div>
    </div>
    
    <div class="postbox">
    <h3>Embed Code: <small> ANDAnime video sizes are ALWAYS 600x400! (Change all "width=number" to "width=600" - Change all "height=number" to "height=400"</small></h3>
    <div class="inside">
    <textarea id="embed" tabindex="6" name="embed" cols="40" rows="2" style="width: 98%;"/>
    <?php echo stripslashes(htmlspecialchars($_POST['embed']));?>
    </textarea>
    </div>
    </div>
    
    </div>
    </div>
    
    <input type="hidden" name="submit" value="submit">
    <input type="submit" name="submit" value="Submit">
    
    </form>
  5. TonyNooblet
    Member
    Posted 2 years ago #

    So how do I get to to set the title to what the category and and video part is? like for an example the category is Caramel because I selected it, and I typed Apple for the input. When I submit the form how do I combine both and get the title to be Caramel Apple?

  6. TonyNooblet
    Member
    Posted 2 years ago #

    Please someone?

  7. TonyNooblet
    Member
    Posted 2 years ago #

    No one seriously knows!?!?

  8. vageez
    Member
    Posted 2 years ago #

    can u put up a link

    so I can see?

  9. mercuryfenix
    Member
    Posted 2 years ago #

    If you have a post value for each it would be something like:
    $category_and_title = $_POST['category'] . $_POST['title'];
    What's so difficult about that? You state your problem so vague, what specifically are you not understanding?

  10. TonyNooblet
    Member
    Posted 2 years ago #

    I've never touched PHP before and this is my first time playing with it..

    it's not working though..
    <?php $title = $_POST['category'] . $_POST['title'];?>

  11. mercuryfenix
    Member
    Posted 2 years ago #

    That was an example, I dont know what your post indexes are. look for the input names
    <?php $title = $_POST[' (insert category's input name here) '] . $_POST[' (insert title's input name here) '];?>

    If you don't have experience with php you should consider hiring somebody else who does. This is a very basic php concept. Learn about it here:
    http://www.w3schools.com/php/php_post.asp

  12. TonyNooblet
    Member
    Posted 2 years ago #

    It still doesn't work.

    <?php $_title = $_POST['category'] . $_POST['partepisode'];?>

    It checks if the user put anything

    <?php
            if(isset($_POST['submit'])){
                    if($_POST['embed'] == ''){
                            echo '<div class="updated" id="message" style="background-color: rgb(255, 251, 204);"><p><strong>You should enter a valid embed-code</strong></div>';
                    }
    
                    if($_POST['thumb'] == ''){
                            echo '<div class="updated" id="message" style="background-color: rgb(255, 251, 204);"><p><strong>You should enter a valid thumbnail URL</strong></div>';
                    }
    
                    if($_POST['title'] == ''){
                            echo '<div class="updated" id="message" style="background-color: rgb(255, 251, 204);"><p><strong>You should enter a title</strong></div>';
                    }
    
    				if($_POST['partepisode'] == ''){
                            echo '<div class="updated" id="message" style="background-color: rgb(255, 251, 204);"><p><strong>You should enter a part or episode number</strong></div>';
                    }
    	}

    and it gives me "You should enter a title" problem. =[ sigh I've been at this for hours.

  13. TonyNooblet
    Member
    Posted 2 years ago #

    Would this possibly work

    <?php $POST['title'] = $_POST['category'] . $_POST['partepisode'];?>

  14. mercuryfenix
    Member
    Posted 2 years ago #

    you aren't showing any understanding of php. read through the lessons on w3shools.com and you should be able to do this

  15. TonyNooblet
    Member
    Posted 2 years ago #

    Ugh.. starting from where?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.