|
|
|
Add a postcard pickup to your sitePreambleMany 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 codeThere 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: 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 itLog 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. |