Forum Moderators: coopster
I have the basics working so that I can display a form with the selected thumbnail image and it's name at the top of the form. Each image page has a link which says something like (the variables are different for each page):
<?phpsession_start();
$_SESSION['imagename'] = 'Nutricia booklet 201';
$_SESSION['imagefilename'] = '<IMG SRC="/Nutricia/thumbnails/tnNutricia booklet 1.jpg">';
$_SESSION['gallery'] = 'Nutricia';
$_SESSION['time'] = time();
echo '<br /><a href="/form/enquiryform.php?' . SID . '">Inquire about using this illustation</a>';
?>
and on the form page:
<?php echo $_SESSION['imagefilename'];?>
<?php echo $_SESSION['imagename'];?>
above the form and used in the code to send details in an email with formmail:
This seems to work so far...My questions are:
How do I:
Code the ability to add another image and image name to the form?
(i've been thinking along the lines of
$_SESSION['imagefilename'] = '[imagename]. Nutricia booklet 201';
On each image page to add the existing variable to the new one (concanternate?) or am I barking up the wrong tree (or just barking)
and/or,
How should I kill the session if I just want the enquiry form sent before the user returns and chooses another image to send an enquiry about?
Thanks in advance
if (!isset($_SESSION['numimages'])) {
$_SESSION['numimages'] = 1;
$next = 1;
} else {
$_SESSION['numimages'] += 1;
$next = $_SESSION['numimages'] + 1;
}
$_SESSION['imagefilename'][$next] = "someimgfilename";
$_SESSION['imagename'][$next] = "someimgname";
That's just off the top of my head. You can use
echo "<pre>";
print_r($_SESSION);
echo "<pre>";
to view the contents of your session. The pre tags make it so you don't have to view source to see it properly formatted.
Then when you mail it you can use a foreach to roll through the images in the session.
$_SESSION ['imagename'] = "$_SESSION[imagename] <br > New Image Title";
$_SESSION['imagefilename'] = "$_SESSION[imagefilename] <IMG SRC='newimagefile.jpg'>";echo '<br /><a href="/form/enquiryform.php?' . SID . '">Equire about using this illustation</a>';
Is there a do not cache page locally command?
there are some good links in there too