0

I want my blog posts to appear inside of a form input box instead of just text on a page. Not the title, but only the submission. Is that possible.

My index.php:

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><b><?php the_title(); ?></b>
=               <div class="entry">
                    <?php the_content('Read more &raquo;'); ?>
                </div>
            </div>
        <?php endwhile; ?>
0

You probably want this:

<form action="demo_form.php">
  <textarea name="blogpost" readonly="readonly">
    <?php the_content(); ?>
  </textarea>
  <input type="submit" value="Submit">
</form> 
  • this works. but the blog posts shows the html tags for example <p> when there is a new paragraph. Is there any way around that? – skootsa Oct 9 '14 at 6:33
  • so you want a wysiwyg editor? – luke Oct 9 '14 at 8:43
1

Do you mean you want the Post content to be used as a placeholder text in a forms text box?

I guess you could do something like this if that is what you are trying to do..

<?php $content = the_content(); ?>

<form action="demo_form.php">
  <input type="text" name="postvalue" placeholder="<?php echo $content ?>">
  <input type="submit" value="Submit">
</form> 
  • I want my posts to appear like this jsfiddle.net/skootsa/vqLvquhe I just don't want viewers to be able to change the placeholder. – skootsa Oct 7 '14 at 23:57
  • use this then in the form. <textarea name="blogpost" readonly="readonly" placeholder="<?php the_content(); ?>"> </textarea> – Benjamin Cuslidge Oct 8 '14 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.