sendcard - the popular opensource PHP e-card script
 
 

 

 

 

STOP THE TRAFFIK

 

Add a postcard pickup to your site

Preamble

Many people like to include the link to the postcard in the email. Some however would prefer the people to visit their site and enter the pickup number in box on their site, as this increases the chances hat people will visit their site.

Stage 1: create the code

There are two pieces of code we need to craft: the pickup form and the PHP program that processes it.

Let's start with the form:

<!-- Begin pickup form -->
<form method="post" action="sendcard/pickup.php">
  Enter your card's id:<br>
  <input type="text" name="id" size="14">
  <br>
  <input type="submit" name="Submit" value="Get my card!">
</form>
<!-- End pickup form -->

This will look like:

Enter your card's id:

That's the form done, so let's write pickup.php.

<?php
/*
 * pickup.php
 * (C) Peter Bowyer, 2002
 */
if (!isset($id)) {
    // Someone is trying to pry.  Send them back to our home page
    header("Location: /");
    exit();
} else {
    header("Location: /sendcard/sendcard.php?view=1&id=$id");
}
?>

Stage 2: Implement it

Log in to the administration area, and change the message sent to the recipient so that instead of containing [card_url] it contains [card_id]. Give them instructions and the URL of your site.

That's all the modifications made - now upload the files, add the form to your front page, and send yourself a card to check it works.