Jump to content

skot

Members
  • Posts

    53
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

skot's Achievements

Member

Member (2/5)

0

Reputation

  1. Also here is the database structure if this helps. The bottom part is a record that did save - subsequent records aren't saving.
  2. Hi All. I want to introduce logging for downloads on our site. To achieve this, each downloadable file will include a small form with a download button. The file path is saved in a hidden form value. Each form posts to download.php, which brings the file name to a disabled input field, and prompts the user for their details before continuing to the download. On completing their details, this posts to downloader.php, which logs the download and users details to a mysql database, presents the user with a "if your file didn't automatically download click here" message, and uses headers to attempt to force the download. Problem A is that the logging doesn't work. I do have one record in the downloadlog table, but on trying again no new records are created.. Problem B is that the automatic download using headers does not work. If I place the php header code above the html code, it is executed without displaying the page, and the incorrect filename is given. Clicking on my manual download link works absolutely fine and holds the same path and filename as given to the automatic download. If I place the php header code after my page content, it does not run at all. Page 1 - product page form:- <form id="form1" method="post" action="../download.php"> <input name="file" type="hidden" id="file" value="../pdf/2009/Introduction_to_Sage_200_Brochure.pdf" /> <input style="border: 1px groove rgb(0, 0, 0); margin-bottom:5px; margin-top:5px; background:transparent url('../img/button_bg1.jpg'); text-align: center; font-family: tahoma; font-size: 12px; color: rgb(255, 255, 255); font-weight:bold" name="download" type="submit" class="pincodebox" id="download" value="Download" /></form> Posts to page 2: download.php: <?php putenv("TZ=Europe/London"); header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"'); session_cache_expire(1440); session_start(); if(!empty($_POST['file'])) $_SESSION['file'] = htmlspecialchars($_POST['file']); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Century Software - Sage 200 Bill of Materials (BOM)</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="cache-control" content="no-store, no-cache, max-age=0, must-revalidate"> <meta http-equiv="pragma" content="no-cache"> <link rel="stylesheet" href="style.css" type="text/css" media="screen,projection" /> <script type="text/javascript"> function validate_required(field,alerttxt) { with (field) { if (value==null||value==""||value=="xx"||value=="123") {alert(alerttxt);return false;} else {return true} } } function validate_form(form1){ with (form1){ if (validate_required(name,"Please enter your name to continue")==false) {name.focus();return false;} if (validate_required(company,"Please enter your company name to continue")==false) {company.focus();return false;} if (validate_required(email,"Please enter your valid email address to continue")==false) {email.focus();return false;} } } </script> <style type="text/css"> <!-- .style1 {font-size: 1.2em} .style5 {font-size: 18px} .style8 {font-size: 8px} .style15 {font-size: 14px; font-weight: bold; font-style: italic; color: #036A67; } .style19 {font-size: 12px; font-weight: bold; font-style: italic; color: #036A67; } .style27 {font-size: 10px; } .style28 {font-size: 1.2em; font-weight: bold; } .style29 {font-size: 14px} .style30 {font-size: 10px; font-weight: bold; } --> </style> </head> <body><div id="container" > <div id="header"> <h1> <iframe src="../fd_header.php" width="758" height="101" scrolling="no" frameborder="0"></iframe> </h1> </div> <div id="navigation"> <ul> <li><a href="index.html" title="Home Page">Home</a></li> <li><a href="aboutus.html" title="About Us">About Us</a></li> <li class="selected"><a href="products/index.html" title="Products">Products</a></li> <li><a href="services/index.html" title="Services">Services</a></li> <li><a href="news.html" title="Company and Client News">News</a></li> <li><a href="partners.html" title="Our Partners">Partners</a></li> <li><a href="events.html" title="Events">Events</a></li> <li><a href="case-studies.html" title="Case Studies">Case Studies</a></li> <li><a href="contactus.html" title="Contact Us">Contact Us</a></li> <li><a href="support/index.html" title="Support">Support</a></li> </ul> </div> <div id="content"> <div class="splitcontentleft"> <h2>Products » Downloads</h2> <div align="justify"> <div class="box"> <h3>Download File</h3> <p><span class="style1">Please enter brief details below in order to continue to your download.</span><br /> </p> <form id="form1" method="post" action="downloader.php" onsubmit="return validate_form(this);"> <div align="center"> <table width="98%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="26" align="right" class="style28">Requested File: </td> <td align="left" class="style5"><span class="style6 style5"> <input name="file" type="text" disabled="disabled" class="style11" id="file" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('img/field_bg4.gif')" value="<?php echo $_SESSION['file']; ?>" size="40" maxlength="200"/> </span></td> </tr> <tr> <td height="26" align="right" class="style28">Your Name: </td> <td align="left" class="style5"><span class="style6 style5"> <input name="name" type="text" class="style11" id="name" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('img/field_bg4.gif')" size="40" maxlength="50"/> </span></td> </tr> <tr> <td height="26" align="right" class="style28">Company Name: </td> <td align="left" class="style5"><span class="style6 style5"> <input name="company" type="text" class="style11" id="company" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('img/field_bg4.gif')" size="40" maxlength="100"/> </span></td> </tr> <tr> <td height="26" align="right" class="style28">Email Address: </td> <td align="left" class="style5"><span class="style6 style5"> <input name="email" type="text" class="style11" id="email" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('img/field_bg4.gif')" value="" size="40" maxlength="100"/> </span></td> </tr> </table> <p></p> <p></p> </div> <p align="center"> <input name="submit" type="submit" class="style11" id="submit" value="Continue To Download..." style="border: 1px groove rgb(0, 0, 0); background:transparent url('img/button_bg1.jpg'); text-align: center; font-family: tahoma; font-size: 14px; color: rgb(255, 255, 255); font-weight:bold; width:200px" onclick="submitPressed()" /></p> </form> <p> </p> </div> </div> </div> </div> <div id="subcontent"> <p align="center"> <iframe src="../goback2.htm" width="162" height="32" scrolling="no" frameborder="0"></iframe> </p> </div> <div id="psubcontent"> <p align="center"> <iframe src="../fd_logos.htm" width="162" height="162" scrolling="No" frameborder="0"></iframe> </p> </div> <div id="footer"> <p>©2009 <a href="aboutus.html">Century Computing Software Services Ltd</a></p> <p align="center" class="small small style5"><span class="style8" lang="EN-GB" xml:lang="EN-GB">Registered in England No: 4374825. VAT Registration No GB 792 5317 09. With registered offices at Century Computing Software Services Ltd<br /> c/o GCN Accounting Services Ltd, Dominique House, 1 Church Road, Netherton, Dudley, West Midlands DY2 0LY.</span></p> </div> </div> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-10217342-1"); pageTracker._trackPageview(); } catch(err) {}</script> </body> </html> Posts to page 3: downloader.php <?php putenv("TZ=Europe/London"); header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"'); session_cache_expire(1440); session_start(); if(!empty($_POST['file'])) $_SESSION['file'] = ($_POST['file']); if(!empty($_POST['name'])) $_SESSION['name'] = htmlspecialchars($_POST['name']); if(!empty($_POST['company'])) $_SESSION['company'] = htmlspecialchars($_POST['company']); if(!empty($_POST['email'])) $_SESSION['email'] = htmlspecialchars($_POST['email']); $file = $_SESSION['file']; $name = $_SESSION['name']; $company = $_SESSION['company']; $email = $_SESSION['email']; $dbhost = 'localhost'; $dbuser = '**************'; $dbpass = '**************'; $dbname = 'downloads'; $table = 'downloadlog'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to database'); mysql_select_db($dbname); @mysql_select_db("$dbname") or die("Error: Unable to select database"); putenv("TZ=Europe/London"); $datetime = date("Y-m-d H:i:s"); $sqlquery = "INSERT INTO $table VALUES('','$datetime','$name','$company','$email','$file','','','','','')"; mysql_query($sqlquery); mysql_close($conn); if(!file) { // File doesn't exist, output error die("Unable to locate requested download file. Please go back and try again."); } else { // Set headers header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=$file"); header("Content-Type: application/pdf"); header("Content-Transfer-Encoding: binary"); // Read the file from disk readfile($file); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Century Software - Downloads</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="cache-control" content="no-store, no-cache, max-age=0, must-revalidate"> <meta http-equiv="pragma" content="no-cache"> <link rel="stylesheet" href="style.css" type="text/css" media="screen,projection" /> <style type="text/css"> <!-- .style1 {font-size: 1.2em} .style5 {font-size: 18px} .style8 {font-size: 8px} .style15 {font-size: 14px; font-weight: bold; font-style: italic; color: #036A67; } .style19 {font-size: 12px; font-weight: bold; font-style: italic; color: #036A67; } .style27 {font-size: 10px; } .style28 {font-size: 1.2em; font-weight: bold; } .style29 {font-size: 14px} .style30 {font-size: 10px; font-weight: bold; } --> </style> </head> <body><div id="container" > <div id="header"> <h1> <iframe src="../fd_header.php" width="758" height="101" scrolling="no" frameborder="0"></iframe> </h1> </div> <div id="navigation"> <ul> <li><a href="index.html" title="Home Page">Home</a></li> <li><a href="aboutus.html" title="About Us">About Us</a></li> <li class="selected"><a href="products/" title="Products">Products</a></li> <li><a href="services/" title="Services">Services</a></li> <li><a href="news.html" title="Company and Client News">News</a></li> <li><a href="partners.html" title="Our Partners">Partners</a></li> <li><a href="events.html" title="Events">Events</a></li> <li><a href="case-studies.html" title="Case Studies">Case Studies</a></li> <li><a href="contactus.html" title="Contact Us">Contact Us</a></li> <li><a href="support/" title="Support">Support</a></li> </ul> </div> <div id="content"> <div class="splitcontentleft"> <h2>Products » Downloads</h2> <div align="justify"> <div class="box"> <h3>Download</h3> <p><span class="style1">Thank you <strong><?php echo $_SESSION['name']; ?></strong>.</span></p> <p><span class="style1"><em>Your download should start automatically within the next few seconds. If it does not please <a href="<?php echo $file ?>" target="_blank"><strong>click here</strong></a> to download manually.</em></span></p> <p class="style1"><strong><font color="#CC0000"><?php echo $errortxt ?></font></strong></p> <p class="style1"><a href="javascript:history.go(-2)" title="Go Back..">Click here to return to the page you were previously viewing.</a></p> </div> </div> </div> </div> <div id="subcontent"> <p align="center"> <iframe src="../goback.htm" width="162" height="32" scrolling="no" frameborder="0"></iframe> </p> </div> <div id="psubcontent"> <p align="center"> <iframe src="../fd_logos.htm" width="162" height="162" scrolling="No" frameborder="0"></iframe> </p> </div> <div id="footer"> <p>©2009 <a href="aboutus.html">Century Computing Software Services Ltd</a></p> <p align="center" class="small small style5"><span class="style8" lang="EN-GB" xml:lang="EN-GB">Registered in England No: 4374825. VAT Registration No GB 792 5317 09. With registered offices at Century Computing Software Services Ltd<br /> c/o GCN Accounting Services Ltd, Dominique House, 1 Church Road, Netherton, Dudley, West Midlands DY2 0LY.</span></p> </div> </div> </body> </html> If want want to try this yourself, and please do to show you what I mean, then start at this page: http://www.centurysoftware.co.uk/products/sage-200-bill-of-materials.html scroll down until you see the Sage 200 Brochure and download button for this. Try the manual link and look at the path. The automatic download tries to use an incorrect filename, but it's using the same variable. Now I can't get the automatic download to work at all. Any help would be greatly appreciated. Thanks for your time.
  3. Sorry - bumping - as original post not seen due to the stupid time i posted it
  4. Oh I also tried this to add the time on as I think that is how it is being stored in the database. And try to see what was being shown in the fields to see if it was working, but that gave me other issues: <?php if(!empty($_POST['from'])) $_SESSION['from'] = htmlspecialchars($_POST['from']); if(!empty($_POST['to'])) $_SESSION['to'] = htmlspecialchars($_POST['to']); $dbhost = 'localhost'; $dbuser = '**************'; $dbpass = '**************'; $dbname = 'bridgey_centuryfeedback'; $table = 'supportfeedback'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to database'); mysql_select_db($dbname); @mysql_select_db("$dbname") or die("Error: Unable to select database"); putenv("TZ=Europe/London"); $datetime = date("Y-m-d H:i:s"); $from2 = ($from) + " 00:00:00"; $to2 = ($to) + " 23:59:59"; echo ($from2); echo ($to2); $querydisplay = ("SELECT * FROM supportfeedback WHERE datetime >= $from2 AND datetime <= $to2") // sending query $result = mysql_query("SELECT * FROM supportfeedback WHERE datetime >= $from AND datetime <= $to"); if (!$result) { die("<b>Error: Query failed</b><br><br><b>Query ran was:</b> {$querydisplay}"); } if ($to = $from) { $label = "dated {$to}"; } elseif ($to <> $from) { $label = "between {$from} and {$to}"; } $fields_num = mysql_num_fields($result); echo "<p style=\"font-family:\"verdana\"; font-size:\"14px\">Century Software Customer Feedback Report (Filtered)</p>"; echo "<br><br><p style=\"font-family:\"verdana\"; font-size:\"10px\">Currently showing records {$label}</p>"; echo "<table border='1'><tr>"; // printing table headers for($i=0; $i<$fields_num; $i++) { $field = mysql_fetch_field($result); echo "<td style=\"font-family:\"verdana\"; font-size:\"10px\">{$field->name}</td>"; } echo "</tr>\n"; // printing table rows while($row = mysql_fetch_row($result)) { echo "<tr>"; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo "<td style=\"font-family:\"verdana\"; font-size:\"10px\">$cell</td>"; echo "</tr>\n"; } mysql_free_result($result); mysql_close($conn); exit; ?>
  5. Hi All, I'm stuck with trying to get a to and from date entry form to run a mysql query to show only certain results on the page. Here is my code: <?php if(!empty($_POST['from'])) $_SESSION['from'] = htmlspecialchars($_POST['from']); if(!empty($_POST['to'])) $_SESSION['to'] = htmlspecialchars($_POST['to']); $dbhost = 'localhost'; $dbuser = '**************'; $dbpass = '**************'; $dbname = 'bridgey_centuryfeedback'; $table = 'supportfeedback'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to database'); mysql_select_db($dbname); @mysql_select_db("$dbname") or die("Error: Unable to select database"); putenv("TZ=Europe/London"); $datetime = date("Y-m-d H:i:s"); // sending query $result = mysql_query("SELECT * FROM supportfeedback WHERE datetime >= $from AND datetime <= $to"); if (!$result) { die("<b>Error: Query failed</b>"); } if ($to = $from) { $label = "dated {$to}"; } elseif ($to <> $from) { $label = "between {$from} and {$to}"; } $fields_num = mysql_num_fields($result); echo "<p style=\"font-family:\"verdana\"; font-size:\"14px\">Customer Feedback Report (Filtered)</p>"; echo "<br><br><p style=\"font-family:\"verdana\"; font-size:\"10px\">Currently showing records {$label}</p>"; echo "<table border='1'><tr>"; // printing table headers for($i=0; $i<$fields_num; $i++) { $field = mysql_fetch_field($result); echo "<td style=\"font-family:\"verdana\"; font-size:\"10px\">{$field->name}</td>"; } echo "</tr>\n"; // printing table rows while($row = mysql_fetch_row($result)) { echo "<tr>"; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo "<td style=\"font-family:\"verdana\"; font-size:\"10px\">$cell</td>"; echo "</tr>\n"; } mysql_free_result($result); mysql_close($conn); exit; ?> Are there any obvious errors you can see? Thanks.
  6. Thanks for advice this is now working almost as expected But! MySQL doesn't record a date/time in the TIMESTAMP field. Do I have to populate this through PHP or can MySQL do it for me? Using phpMyAdmin as database front end.
  7. Was following a tutorial.. guess it wasn't a good one! Will review. Thanks.
  8. Form: <form name="contactform" id="contactform" method="post" action="SendFeedback.php"> <div align="center"> <p><br /> <strong>We would be greatful if you could spare a moment of your time to let us know what you thought about your support experience today.<br /> <br /> This process is completely optional and you can close this page if you wish. All feedback received will be treated confidentially.</strong></p> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td height="26" class="style51"><div align="right" class="style51"> <div align="right" class="style6"> <div align="right" class="style51"><strong>Your Name: </strong></div> </div> </div></td> <td colspan="5" align="left" class="style51"><span class="style6 style5"> <input name="name" type="text" class="textfield" id="name" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('http://www.centurysoftware.co.uk/img/field_bg4.gif')" size="30" maxlength="40"/> </span></td> </tr> <tr> <td height="26" class="style51"><div align="right" class="style51"> <div align="right"><strong>Company Name: </strong></div> </div></td> <td colspan="5" align="left" class="style51"><span class="style6 style5"> <input name="company" type="text" class="textfield" id="company" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('http://www.centurysoftware.co.uk/img/field_bg4.gif')" size="30" maxlength="40"/> </span></td> </tr> <tr> <td height="26" class="style51"><div align="center" class="style51"> <div align="right"><strong>Email Address: <br /> </strong></div> </div></td> <td colspan="5" align="left" class="style51"><span class="style6 style5"> <input name="email" type="text" class="textfield" id="email" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('http://www.centurysoftware.co.uk/img/field_bg4.gif')" size="30" maxlength="40"/> </span></td> </tr> </table> <br /> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td height="26" colspan="6" class="style5"><div align="center" class="style51"> <div align="center"><strong>Please rate us on the following aspects of your support experience</strong><br /> <em>Please tick only one box per question</em><br /> <br /> </div> </div></td> </tr> <tr> <td height="26" align="left" valign="middle" class="style5"><div align="left" class="style51"> <div align="left"><strong><br /> </strong></div> </div></td> <td width="55" height="26" align="center" valign="middle" class="style5" style="font-size: 9px; font-style: italic; font-weight: bold;">VeryPoor</td> <td width="55" align="center" valign="middle" class="style5"><span class="style51" style="font-size: 9px; font-style: italic; font-weight: bold;">Poor</span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51" style="font-size: 9px; font-style: italic; font-weight: bold;">Fair</span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51" style="font-size: 9px; font-style: italic; font-weight: bold;">Good</span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51" style="font-size: 9px; font-style: italic; font-weight: bold;">Very Good</span></td> </tr> <tr> <td height="26" class="style5"><strong> 1. The speed at which your query was dealt with </strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input value="1" type="checkbox" name="a1" id="a1" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="b1" id="b1" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="c1" id="c1" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="d1" id="d1" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="e1" id="e1" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong> 2. The quality of the solution provided</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="a2" id="a2" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="b2" id="b2" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="c2" id="c2" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="d2" id="d2" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="e2" id="e2" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>3. Technical knowledge of the person who worked with you</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="a3" id="a3" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="b3" id="b3" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="c3" id="c3" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="d3" id="d3" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="e3" id="e3" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>4. Our ability to understand your needs</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="a4" id="a4" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="b4" id="b4" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="c4" id="c4" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="d4" id="d4" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="e4" id="e4" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>5. Keeping you informed on the status of your enquiry</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="a5" id="a5" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="b5" id="b5" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="c5" id="c5" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="d5" id="d5" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="e5" id="e5" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>6. How friendly and professional we were</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="a6" id="a6" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="b6" id="b6" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="c6" id="c6" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="d6" id="d6" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="e6" id="e6" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>7. How easy it was for you to contact us</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="a7" id="a7" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="b7" id="b7" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="c7" id="c7" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="d7" id="d7" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="e7" id="e7" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>8. Overall quality of service received</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="a8" id="a8" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="b8" id="b8" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="c8" id="c8" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="d8" id="d8" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="e8" id="e8" /> </span></td> </tr> </table> <br /> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td height="26" class="style51"><strong>9. Would you like to comment on anything else?</strong></td> </tr> <tr> <td height="26" align="center" class="style51"><textarea name="comments" id="comments" cols="35" rows="3" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('http://www.centurysoftware.co.uk/img/field_bg4.gif')"></textarea></td> </tr> </table> <br /> </div><p align="center"> <input name="submit" type="submit" class="style6" id="submit" value="Send Feedback" style="border: 1px groove rgb(0, 0, 0); background:transparent url('http://www.centurysoftware.co.uk/img/button_bg1.jpg'); text-align: center; font-family: tahoma; font-size: 14px; color: rgb(255, 255, 255); font-weight:bold; width:200px"></form> PHP: <?php @extract($_POST); $name = stripslashes($name); $company = stripslashes($company); $email = stripslashes($email); $a1 = stripslashes($a1); $b1 = stripslashes($b1); $c1 = stripslashes($c1); $d1 = stripslashes($d1); $e1 = stripslashes($e1); $a2 = stripslashes($a2); $b2 = stripslashes($b2); $c2 = stripslashes($c2); $d2 = stripslashes($d2); $e2 = stripslashes($e2); $a3 = stripslashes($a3); $b3 = stripslashes($b3); $c3 = stripslashes($c3); $d3 = stripslashes($d3); $e3 = stripslashes($e3); $a4 = stripslashes($a4); $b4 = stripslashes($b4); $c4 = stripslashes($c4); $d4 = stripslashes($d4); $e4 = stripslashes($e4); $a5 = stripslashes($a5); $b5 = stripslashes($b5); $c5 = stripslashes($c5); $d5 = stripslashes($d5); $e5 = stripslashes($e5); $a6 = stripslashes($a6); $b6 = stripslashes($b6); $c6 = stripslashes($c6); $d6 = stripslashes($d6); $e6 = stripslashes($e6); $a7 = stripslashes($a7); $b7 = stripslashes($b7); $c7 = stripslashes($c7); $d7 = stripslashes($d7); $e7 = stripslashes($e7); $a8 = stripslashes($a8); $b8 = stripslashes($b8); $c8 = stripslashes($c8); $d8 = stripslashes($d8); $e8 = stripslashes($e8); $comments = stripslashes($comments); $dbhost = 'localhost'; $dbuser = '***************'; $dbpass = '***************'; $dbname = 'bridgey_centuryfeedback'; $table = 'supportfeedback'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to database'); mysql_select_db($dbname); @mysql_select_db("$dbname") or die("Error: Unable to select database"); $sqlquery = "INSERT INTO $table VALUES('','','$name','$company','$email','$a1','$b1','$c1','$d1','$e1','$a2','$b2','$c2','$d2','$e2','$a3','$b3','$c3','$d3','$e3','$a4','$b4','$c4','$d4','$e4','$a5','$b5','$c5','$d5','$e5','$a6','$b6','$c6','$d6','$e6','$a7','$b7','$c7','$d7','$e7','$a8','$b8','$c8','$d8','$e8','$comments','','','')"; mysql_close($conn); // redir when sent.... header("Location: http://centurysoftware.co.uk/fbsent.htm"); exit; ?> I am using field 1 in the database for an ID no which should automatically save 000001 to the first record then automatically increment. Field 2 is a timestamp which should update when the record is saved. Fields 3 and beyond are the actual form content, with the last 3 fields left blank as spare fields. I have left gaps in the SQL query for fields I do not want to populate. Perhaps I have done this incorrectly?
  9. Hi PFMaBiSmAd, thanks for the advice. I have redesigned everything including my database structure forms and php processing code to use "a1, b1.." instead of "1a, 1b..". I do not get any errors now, but if I look at the MySQL table through my control panel there are no entries within it.
  10. Hi All, I'm trying to set up a survey that will post form results to a database. Now bare with me because this is the first time I've really used mysql with php. Basically I get this error and I'm not sure why. Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/bridgey/public_html/SendFeedback.php on line 11 Heres the code for the form page: <form name="contactform" id="contactform" method="post" action="SendFeedback.php" onsubmit="return validate_form(this);"> <div align="center"> <p><br /> <strong>We would be greatful if you could spare a moment of your time to let us know what you thought about your support experience today.<br /> <br /> This process is completely optional and you can close this page if you wish. All feedback received will be treated confidentially.</strong></p> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td height="26" class="style51"><div align="right" class="style51"> <div align="right" class="style6"> <div align="right" class="style51"><strong>Your Name: </strong></div> </div> </div></td> <td colspan="5" align="left" class="style51"><span class="style6 style5"> <input name="name" type="text" class="textfield" id="name" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('http://www.centurysoftware.co.uk/img/field_bg4.gif')" size="30" maxlength="40"/> </span></td> </tr> <tr> <td height="26" class="style51"><div align="right" class="style51"> <div align="right"><strong>Company Name: </strong></div> </div></td> <td colspan="5" align="left" class="style51"><span class="style6 style5"> <input name="company" type="text" class="textfield" id="company" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('http://www.centurysoftware.co.uk/img/field_bg4.gif')" size="30" maxlength="40"/> </span></td> </tr> <tr> <td height="26" class="style51"><div align="center" class="style51"> <div align="right"><strong>Email Address: <br /> </strong></div> </div></td> <td colspan="5" align="left" class="style51"><span class="style6 style5"> <input name="email" type="text" class="textfield" id="email" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('http://www.centurysoftware.co.uk/img/field_bg4.gif')" size="30" maxlength="40"/> </span></td> </tr> </table> <br /> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td height="26" colspan="6" class="style5"><div align="center" class="style51"> <div align="center"><strong>Please rate us on the following aspects of your support experience</strong><br /> <em>Please tick only one box per question</em><br /> <br /> </div> </div></td> </tr> <tr> <td height="26" align="left" valign="middle" class="style5"><div align="left" class="style51"> <div align="left"><strong><br /> </strong></div> </div></td> <td width="55" height="26" align="center" valign="middle" class="style5" style="font-size: 9px; font-style: italic; font-weight: bold;">VeryPoor</td> <td width="55" align="center" valign="middle" class="style5"><span class="style51" style="font-size: 9px; font-style: italic; font-weight: bold;">Poor</span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51" style="font-size: 9px; font-style: italic; font-weight: bold;">Fair</span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51" style="font-size: 9px; font-style: italic; font-weight: bold;">Good</span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51" style="font-size: 9px; font-style: italic; font-weight: bold;">Very Good</span></td> </tr> <tr> <td height="26" class="style5"><strong> 1. The speed at which your query was dealt with </strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input value="1" type="checkbox" name="1a" id="1a" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="1b" id="1b" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="1c" id="1c" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="1d" id="1d" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="1e" id="1e" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong> 2. The quality of the solution provided</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="2a" id="2a" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="2b" id="2b" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="2c" id="2c" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="2d" id="2d" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="2e" id="2e" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>3. Technical knowledge of the person who worked with you</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="3a" id="3a" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="3b" id="3b" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="3c" id="3c" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="3d" id="3d" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="3e" id="3e" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>4. Our ability to understand your needs</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="4a" id="4a" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="4b" id="4b" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="4c" id="4c" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="4d" id="4d" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="4e" id="4e" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>5. Keeping you informed on the status of your enquiry</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="5a" id="5a" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="5b" id="5b" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="5c" id="5c" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="5d" id="5d" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="5e" id="5e" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>6. How friendly and professional we were</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="6a" id="6a" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="6b" id="6b" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="6c" id="6c" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="6d" id="6d" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="6e" id="6e" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>7. How easy it was for you to contact us</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="7a" id="7a" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="7b" id="7b" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="7c" id="7c" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="7d" id="7d" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="7e" id="7e" /> </span></td> </tr> <tr> <td height="26" class="style5"><strong>8. Overall quality of service received</strong></td> <td width="55" height="26" align="center" valign="middle" class="style5"><input type="checkbox" name="8a" id="8a" /></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="8b" id="8b" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="8c" id="8c" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="8d" id="8d" /> </span></td> <td width="55" align="center" valign="middle" class="style5"><span class="style51"> <input value="1" type="checkbox" name="8e" id="8e" /> </span></td> </tr> </table> <br /> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td height="26" class="style51"><strong>9. Would you like to comment on anything else?</strong></td> </tr> <tr> <td height="26" align="center" class="style51"><textarea name="9" id="9" cols="40" rows="3" style="border: 1px groove #036B6A; font-family:tahoma; font-size:14px; background:transparent url('http://www.centurysoftware.co.uk/img/field_bg4.gif')"></textarea></td> </tr> </table> <br /> </div><p align="center"> <input name="submit" type="submit" class="style6" id="submit" value="Send Feedback" style="border: 1px groove rgb(0, 0, 0); background:transparent url('http://www.centurysoftware.co.uk/img/button_bg1.jpg'); text-align: center; font-family: tahoma; font-size: 14px; color: rgb(255, 255, 255); font-weight:bold; width:200px" onclick="submitPressed()"></form> And here's my SendFeedback.php <?php @extract($_POST); $name = stripslashes($name); $company = stripslashes($company); $email = stripslashes($email); $1a = stripslashes($1a); $1b = stripslashes($1b); $1c = stripslashes($1c); $1d = stripslashes($1d); $1e = stripslashes($1e); $2a = stripslashes($2a); $2b = stripslashes($2b); $2c = stripslashes($2c); $2d = stripslashes($2d); $2e = stripslashes($2e); $3a = stripslashes($3a); $3b = stripslashes($3b); $3c = stripslashes($3c); $3d = stripslashes($3d); $3e = stripslashes($3e); $4a = stripslashes($4a); $4b = stripslashes($4b); $4c = stripslashes($4c); $4d = stripslashes($4d); $4e = stripslashes($4e); $5a = stripslashes($5a); $5b = stripslashes($5b); $5c = stripslashes($5c); $5d = stripslashes($5d); $5e = stripslashes($5e); $6a = stripslashes($6a); $6b = stripslashes($6b); $6c = stripslashes($6c); $6d = stripslashes($6d); $6e = stripslashes($6e); $7a = stripslashes($7a); $7b = stripslashes($7b); $7c = stripslashes($7c); $7d = stripslashes($7d); $7e = stripslashes($7e); $8a = stripslashes($8a); $8b = stripslashes($8b); $8c = stripslashes($8c); $8d = stripslashes($8d); $8e = stripslashes($8e); $9 = stripslashes($9); $dbhost = 'localhost'; $dbuser = '***********'; $dbpass = '***********'; $dbname = 'centuryfeedback'; $table = 'supportfeedback'; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to database'); mysql_select_db($dbname); @mysql_select_db("$dbname") or die("Error: Unable to select database"); $sqlquery = "INSERT INTO $table VALUES('','','$name','$company','$email','$1a','$1b','$1c','$1d','$1e','$2a','$2b','$2c','$2d','$2e','$3a','$3b','$3c','$3d','$3e','$4a','$4b','$4c','$4d','$4e','$5a','$5b','$5c','$5d','$5e','$6a','$6b','$6c','$6d','$6e','$7a','$7b','$7c','$7d','$7e','$8a','$8b','$8c','$8d','$8e','$9')"; mysql_close($conn); // redir when sent.... header("Location: http://centurysoftware.co.uk/fbsent.htm"); exit; ?> You can see it here: www.centurysoftware.co.uk/support/survey.htm Don't worry about the htm it is running php inside. Thanks in advance.
  11. Hi I've used adobe fireworks to splice an image so I can place text inside it. This displays ok in internet explorer, but looks odd in firefox?? Any ideas? Have tried style display:block http://www.centurysoftware.co.uk/beta/ Thanks in Advance
  12. Hi Rhodesa. Thanks for your help. I have removed 'null' from the code but I receive a php error. The code is now: <?php session_start(); $_SESSION['name']=!empty($_POST['name'])? htmlspecialchars($_POST['name']); $_SESSION['company']=!empty($_POST['company'])? htmlspecialchars($_POST['company']); $_SESSION['sector']=!empty($_POST['sector'])? htmlspecialchars($_POST['sector']); $_SESSION['tel']=!empty($_POST['tel'])? htmlspecialchars($_POST['tel']); $_SESSION['mob']=!empty($_POST['mob'])? htmlspecialchars($_POST['mob']); $_SESSION['email']=!empty($_POST['email'])? htmlspecialchars($_POST['email']); $_SESSION['a1']=!empty($_POST['a1'])? htmlspecialchars($_POST['a1']); $_SESSION['a2']=!empty($_POST['a2'])? htmlspecialchars($_POST['a2']); $_SESSION['a3']=!empty($_POST['a3'])? htmlspecialchars($_POST['a3']); $_SESSION['a4']=!empty($_POST['a4'])? htmlspecialchars($_POST['a4']); $_SESSION['a5']=!empty($_POST['a5'])? htmlspecialchars($_POST['a5']); ?> But when I go to page 2 I get this error:- Parse error: syntax error, unexpected T_VARIABLE in /home/bridgey/public_html/cs_bookdemo2.php on line 4
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.