• Hi, we have a website where we’ve added some donation buttons.

    When the visitors clicks the “Donate now” button, we would like the following page to clearly tell the visitors what cause they are supporting.

    How can we pass the page / post title in the form of “You are now donating to the example #1 cause” (where “Example #1” would be the page title) of the first page into the next page where the users fills out all his personal information?

    Thank you for all replies in advance.

Viewing 1 replies (of 1 total)
  • Simple way would be to put a hidden field in the form on the page:

    <input type="hidden" value="<?php the_title() ?>" name="dtitle" />

    Then on your form page that is posted to (assuming it uses a default page template too)

    <h1>
    <?php
    if(isset($_POST['dtitle']){
        echo('You are donating to the: ' . $_POST['dtitle']);
    }else{
        the_title();
    }
    ?>
    </h1>
Viewing 1 replies (of 1 total)
  • The topic ‘How to pass post/page title when clicking button?’ is closed to new replies.