Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Task

Featured Replies

Ok, I'm new here so thanks for being so welcoming :)

 

I have a big task, and any help from anyone would be greatly appreciated, even if its just a link to some tutorials or something.

 

Outline of the task, then:

 

I have been asked to develop a website for a Travel Agents, who specializes in the Cape Verde Islands. The website itself is well on its way, and I have managed to include some dynamic menus etc. with SSIs.

 

The problem I am having is that the company have their own brochure. They want a form on the website (.../ourbrochure.shtml), which I have done for them. They want the form to be emailed to a particular address when the user fills it in. I did this, and used FormMail, which worked perfectly. So, you would think I'd be happy, but NOW, comes the interesting (annoying) part.

 

They still want the results emailed, but they also want it automatically adding to a database. I have databases, so this is not a problem. However, I cant seem to get the script to work correctly. I did at one point, but the email never went through. I only seem to be getting internal server error.

 

Beyond this, they want a word document which will read from ms access, which in turn reads from the database. Confusing!

 

So, they want an MS Access file to read from the database. They then want it to pass the data over when they open the word document. The whole aim of this is to create a template for when they print the labels out for posting the brochures.

 

Anything you can help me with on this, even if its just some advice on a particular part, will be greatly appreciated !

 

Thank you !

 

(Hope I havent confused anyone as I find it very hard to put across in words!)

 

 

ourbrochure.shtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Cape Verde Travel - Our Brochure</title>
<!--#include file="SpryAssets/tabhead.html" -->
<!--#include file="SpryAssets/menuhead.html" -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body,td,th {
font-family: Calibri;
font-size: 11pt;
color: #0099FF;
}
body {
background-color: #B4EAE9;
}
a {
font-size: 11pt;
font-family: Calibri;
color: #0099FF;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #0099FF;
}
a:hover {
text-decoration: none;
color: #0099FF;
}
a:active {
text-decoration: none;
color: #0099FF;
}
h1,h2,h3,h4,h5,h6 {
font-weight: bold;
}
h1 {
font-size: 16pt;
}
h2 {
font-size: 14pt;
}
h3 {
font-size: 12pt;
}
.style1 {font-size: 9pt}
-->
</style>

</head>

<body>
<table width="700" height="862" border="0" align="center">
 <tr>
   <th height="168" colspan="4" bordercolor="0" scope="col"><img src="Images/Banner.png" alt="Banner" width="700" height="150" /></th>
 </tr>
 <tr>
   <th width="258" height="61" align="center" bordercolor="0" scope="row"><embed pluginspage="http://www.adobe.com/go/getflashplayer" src="http://www.yourminis.com/Dir/GetContainer.api?uri=yourminis/yourminis/mini:weather"  wmode="transparent" width="250" height="80" flashvars="cr=0&textcolor=822770&color=3341538&view=minimal&loc=Praia%2C%20Cape%20Verde&unit=m&zipcode=CVXX0002&title=Weather%20%28CVXX0002%29&mininame=weather&height=70&width=240&xheight=80&xwidth=250&uri=yourminis%2Fyourminis%2Fmini%3Aweather&swfurl=%2Fwidget%5Fweatherchannel%2Eswf&" type="application/x-shockwave-flash" allowscriptaccess="always"></embed></th>
   <th height="61" colspan="3" align="center" bordercolor="0" scope="row"><!--#include file="SpryAssets/tab.html" --></th>
 </tr>
 <tr>
   <th height="39" colspan="4" align="center" bordercolor="0" scope="row"><!--#include file="SpryAssets/menu.html" --></th>
 </tr>
 <tr>
   <th height="304" colspan="4" bordercolor="0" scope="row"><br /><br /><form action="../../cgi-bin/cvt-reqcat.cgi" method="post" enctype="application/x-www-form-urlencoded" name="Brochure">Name<font color="#FF0000">*</font>:        <input name="cust_name" type="text" size="20" /><input name="cust_type" type="checkbox" value="Agent" /> Tick if you are an Agent<br /><br />Email (Must be valid)<font color="#FF0000">*</font>:        <input name="cust_email" type="text" size="25" /><br /><br />Phone:        <input name="cust_phone" type="text" size="25" /><br /><br />Street Address<font color="#FF0000">*</font>:        <input name="cust_add1" type="text" /><br /><br />Town/City:        <input name="cust_city" type="text" /><br /><br />County:        <input name="cust_county" type="text" /><br /><br />Postcode<font color="#FF0000">*</font>:        <input name="cust_postcode" type="text" /><br /><br />Country (If outside UK):        <input name="cust_country" type="text" /><br /><br />Where did you hear about us?:        <input name="wherefrom" type="text" /><br /><br /><input name="consent" type="checkbox" value="Yes" /> Yes, I would like more information on the Cape Verde Islands<br /><br /><input name="Request Brochure" type="submit" value="Request Brochure" /><br /><br /><font color="#FFFFFF"><a href="dataprotectionpolicy.html" class="style1">Click to view our Data Protection Policy</a></font><br /><br />
   </form></th>
 </tr>
 <tr>
</table>
<p> </p>
<!--#include file="SpryAssets/tabbody.html" -->
<!--#include file="SpryAssets/menubody.html" -->
</body>
</html>

 

 

 

cvt-reqcat.cgi (the script)

#!/usr/bin/perl 

#----------------------------------------------------------------
#Web
#----------------------------------------------------------------
print "Content-type: text/html\n\n";
#print " test\n";
#------------------------Initial---------------------------------
read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@cgiPairs = split(/&/,$buffer);
foreach $cgiPair (@cgiPairs)
{
 ($name,$value) = split(/=/,$cgiPair);
 $value =~ s/\+/ /g;
 $value =~ s/%(..)/pack("c",hex($1))/ge;
  $save = $value;
 $form{$name} .= "\0" if (defined($form{$name}));
 $form{$name} .= "$value";
}

#$mailto="a@a.com";

#$mailfrom="a@a.com";

$SUBJECT="Request Brochure";

&SENDMAIL;
#&SENDMAILCLT;
#&SENDMYCOPY;

&THANKS;

#-----------------------------------------------THE END------------------------------------------
exit;
sub SENDMAIL
{
$TESTFLD="cust_name";
    $FLDLEN= 35;
    $AMPRESAND ="NO";
   &TESTSPAM;
    $SPAM="FALSE";
    $SPAM="FALSE";
    $TESTFLD ="cust_email";
    $FLDLEN= 35;
    &TESTSPAM;

    $TESTFLD="cust_phone";
    $FLDLEN= 35;
    $AMPRESAND ="NO";
    &TESTSPAM;

     $TESTFLD="cust_add1";
     $FLDLEN=200;
    &TESTSPAMADDRESS;

    $TESTFLD="cust_city";
    $FLDLEN=50;
    $AMPRESAND ="NO";
    &TESTSPAM;
    $TESTFLD="cust_county";
    $FLDLEN=25;
    $AMPRESAND ="NO";
    &TESTSPAM;

    $TESTFLD="cust_postcode";
    $FLDLEN=25;
    $AMPRESAND ="NO";
    &TESTSPAM;

    $TESTFLD="cust_country";
     $FLDLEN=25;
    $AMPRESAND ="NO";
    &TESTSPAM;

    $TESTFLD="wherefrom";
     $FLDLEN=25;
    $AMPRESAND ="NO";
    &TESTSPAM;

#print "test $SPAM - $mailto - $FROM\n";exit;
   $mailprog = '/usr/lib/sendmail -oi -t';

#if ( $SPAM ne "TRUE" and $form{'email'} ne "")
#{
   open(MAIL,"|$mailprog -t");
#}
#else
#{
#   open(MAIL,">> SPAMTRAP");
#}

   $TO="$mailto";
   $FROM="$form{'email'}";
   print MAIL "To: $TO\n";
   print MAIL "From: $FROM\n";
   &BODY;

}


sub TESTSPAM
{


   if ($form{$TESTFLD} =~ /$domain/){ $SPAM="TRUE";}

   if ($form{$TESTFLD} =~ /To\:/){ $SPAM="TRUE";}
   if ($form{$TESTFLD} =~ /From\:/){ $SPAM="TRUE";}
   if ($form{$TESTFLD} =~ /\r/){ $SPAM="TRUE";}
   if ($form{$TESTFLD} =~ /\n/){ $SPAM="TRUE";}
   if ($form{$TESTFLD} =~ /\|/){ $SPAM="TRUE";}
   if ($form{$TESTFLD} =~ /\`/){ $SPAM="TRUE";}
   if ($form{$TESTFLD} =~ /\;/){ $SPAM="TRUE";}   

$form{$TESTFLD} =~ s/\r/ /g;
$form{$TESTFLD} =~ s/\n/ /g;

      $form{$TESTFLD}=substr($form{$TESTFLD}, 0,$FLDLEN);

}

sub TESTSPAMADDRESS
{
if ($form{$TESTFLD} =~ /$domain/){ $SPAM="TRUE";}
   if ($form{$TESTFLD} =~ /To\:/){ $SPAM="TRUE";}
   if ($form{$TESTFLD} =~ /From\:/){ $SPAM="TRUE";}
#    if ($form{$TESTFLD} =~ /\r/){ $SPAM="TRUE";}
#    if ($form{$TESTFLD} =~ /\n/){ $SPAM="TRUE";}
   if ($form{$TESTFLD} =~ /\|/){ $SPAM="TRUE";}
   if ($form{$TESTFLD} =~ /\`/){ $SPAM="TRUE";}
   if ($form{$TESTFLD} =~ /\;/){ $SPAM="TRUE";} 

$form{$TESTFLD} =~ s/\r/ /g;
$form{$TESTFLD} =~ s/\n/ /g;


$form{$TESTFLD}=substr($form{$TESTFLD}, 0,$FLDLEN);  

}


sub BODY
{ 
  # Check for Message Subject
  print MAIL "Subject: Quote Request\n\n";
  print MAIL "Name.............:  $form{'cust_name'}\n";
  print MAIL "Email............:  $form{'cust_email'}\n";
  print MAIL "Customer Type....:  $form{'cust_type'}\n";
  print MAIL "Telephone........:  $form{'cust_phone'}\n";
  print MAIL "Address..........:  $form{'cust_add1'}\n";
  print MAIL "Town.............:  $form{'cust_city'}\n";
  print MAIL "County...........:  $form{'cust_county'}\n";
  print MAIL "Country..........:  $form{'cust_country'}\n"; 
  print MAIL "How Found........:  $form{'wherefrom'}\n";
  print MAIL "Send Other Info..:  $form{'consent'}\n";


  close (MAIL);
}



sub THANKS
{
print "<html>";
print "<head>";
print "<title>Thanks </title>";
print <meta http-equiv="REFRESH" content="0;url=http://www.google.com">
print "</head><body bgcolor=\"#ffffff\" > ";
print "<p align=\"center\"><font color= \"#000000\" size=\"3\"><b><br><br><br><br>";
print "Thank you for your enquiry. A member of our staff will contact you shortly";
print "</body >";
print "</html>";
}

You will need to use sql commands (INSERT INTO database name WHERE etc etc) to write to the database. If your website is going to get a lot of traffic, it would be preferable to use a mysql database rather than access, or else you run the risk of crashing the database permanently. Not sure how its done with cgi, but I'm sure there are lots of php tutorials that would be appropriate.

If your running Access locally for the travel agency. Access is built on MS SQL as a query language. It is fairly trivial connecting an Access database to the web provided your server is running MS SQL. If not you will need to bridge the gap.

 

Fairly generic answer, but you will have to do far more research before posting a question as specialist.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.