Jump to content

skot

Members
  • Posts

    53
  • Joined

  • Last visited

    Never

Everything posted by skot

  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
  13. Hi All, I'm trying to use a multi-page form to collect form entered data and email this to myself. I have tried multiple methods of doing this and using sessions seems to be the answer. The issue is that no variables are actually passed over, thus not a lot is emailed. URL: http://www.centurysoftware.co.uk/demonstrations.html I am using cs_bookdemo.php to collect name, numbers and addresses. This form posts to cs_bookdemo2.php, which contains the following code:- <?php session_start(); $_SESSION['name']=!empty($_POST['name'])? htmlspecialchars($_POST['name']) : null; $_SESSION['company']=!empty($_POST['company'])? htmlspecialchars($_POST['company']) : null; $_SESSION['sector']=!empty($_POST['sector'])? htmlspecialchars($_POST['sector']) : null; $_SESSION['tel']=!empty($_POST['tel'])? htmlspecialchars($_POST['tel']) : null; $_SESSION['mob']=!empty($_POST['mob'])? htmlspecialchars($_POST['mob']) : null; $_SESSION['emai']=!empty($_POST['email'])? htmlspecialchars($_POST['email']) : null; $_SESSION['a1']=!empty($_POST['a1'])? htmlspecialchars($_POST['a1']) : null; $_SESSION['a2']=!empty($_POST['a2'])? htmlspecialchars($_POST['a2']) : null; $_SESSION['a3']=!empty($_POST['a3'])? htmlspecialchars($_POST['a3']) : null; $_SESSION['a4']=!empty($_POST['a4'])? htmlspecialchars($_POST['a4']) : null; $_SESSION['a5']=!empty($_POST['a5'])? htmlspecialchars($_POST['a5']) : null; ?> cs_bookdemo2.php collects more information and posts to cs_bookdemo3.php, which has the same session code and variables with the addition of the fields just posted on page 2: <?php session_start(); $_SESSION['name']=!empty($_POST['name'])? htmlspecialchars($_POST['name']) : null; $_SESSION['company']=!empty($_POST['company'])? htmlspecialchars($_POST['company']) : null; $_SESSION['sector']=!empty($_POST['sector'])? htmlspecialchars($_POST['sector']) : null; $_SESSION['tel']=!empty($_POST['tel'])? htmlspecialchars($_POST['tel']) : null; $_SESSION['mob']=!empty($_POST['mob'])? htmlspecialchars($_POST['mob']) : null; $_SESSION['emai']=!empty($_POST['email'])? htmlspecialchars($_POST['email']) : null; $_SESSION['a1']=!empty($_POST['a1'])? htmlspecialchars($_POST['a1']) : null; $_SESSION['a2']=!empty($_POST['a2'])? htmlspecialchars($_POST['a2']) : null; $_SESSION['a3']=!empty($_POST['a3'])? htmlspecialchars($_POST['a3']) : null; $_SESSION['a4']=!empty($_POST['a4'])? htmlspecialchars($_POST['a4']) : null; $_SESSION['a5']=!empty($_POST['a5'])? htmlspecialchars($_POST['a5']) : null; $_SESSION['p1']=!empty($_POST['p1'])? htmlspecialchars($_POST['p1']) : null; $_SESSION['p2']=!empty($_POST['p2'])? htmlspecialchars($_POST['p2']) : null; $_SESSION['p3']=!empty($_POST['p3'])? htmlspecialchars($_POST['p3']) : null; $_SESSION['reqdate']=!empty($_POST['reqdate'])? htmlspecialchars($_POST['reqdate']) : null; $_SESSION['time']=!empty($_POST['time'])? htmlspecialchars($_POST['time']) : null; ?> Page 3 then collects more information and posts to cs_bookdemo4.php, which contains the email code: <?php session_start(); $_SESSION['name']=!empty($_POST['name'])? htmlspecialchars($_POST['name']) : null; $_SESSION['company']=!empty($_POST['company'])? htmlspecialchars($_POST['company']) : null; $_SESSION['sector']=!empty($_POST['sector'])? htmlspecialchars($_POST['sector']) : null; $_SESSION['tel']=!empty($_POST['tel'])? htmlspecialchars($_POST['tel']) : null; $_SESSION['mob']=!empty($_POST['mob'])? htmlspecialchars($_POST['mob']) : null; $_SESSION['emai']=!empty($_POST['email'])? htmlspecialchars($_POST['email']) : null; $_SESSION['a1']=!empty($_POST['a1'])? htmlspecialchars($_POST['a1']) : null; $_SESSION['a2']=!empty($_POST['a2'])? htmlspecialchars($_POST['a2']) : null; $_SESSION['a3']=!empty($_POST['a3'])? htmlspecialchars($_POST['a3']) : null; $_SESSION['a4']=!empty($_POST['a4'])? htmlspecialchars($_POST['a4']) : null; $_SESSION['a5']=!empty($_POST['a5'])? htmlspecialchars($_POST['a5']) : null; $_SESSION['p1']=!empty($_POST['p1'])? htmlspecialchars($_POST['p1']) : null; $_SESSION['p2']=!empty($_POST['p2'])? htmlspecialchars($_POST['p2']) : null; $_SESSION['p3']=!empty($_POST['p3'])? htmlspecialchars($_POST['p3']) : null; $_SESSION['reqdate']=!empty($_POST['reqdate'])? htmlspecialchars($_POST['reqdate']) : null; $_SESSION['time']=!empty($_POST['time'])? htmlspecialchars($_POST['time']) : null; $_SESSION['location']=!empty($_POST['location'])? htmlspecialchars($_POST['location']) : null; $_SESSION['source']=!empty($_POST['source'])? htmlspecialchars($_POST['source']) : null; $_SESSION['notes']=!empty($_POST['notes'])? htmlspecialchars($_POST['notes']) : null; mail('myemail@address.co.uk','** New Product Demo Request ($reqdate) (Time: $time) **',"A website visitor has submitted the following demonstration request:-\n\n Requested Date: $reqdate \n Requested Time Slot: $time \n Demo Location: $location \n \n\n Their Details:-\n \n Their Name: $name \n Company Name: $company \n Job Position: $job \n Sector: $sector \n\n \n Telephone: $tel \n Mobile: $mobile \n Email: $email \n \n Company Address:-\n $a1 \n $a2 \n $a3 \n $a4 \n $a5 \n \n Source: $source \n \n Product Details:-\n \n 1: $p1 \n 2: $p2 \n 3: $p3 \n \n Additional Notes:-\n \n $notes \n Form sent from IP address: $ip","From: CenturySoftware.co.uk <website@centurysoftware.co.uk>") or die("Unable to send form data, please contact us"); ?> The resulting email output is everything above but excludes any data entered by the user. What am I doing wrong? I have also tried using hidden fields and populating these fields with php, and getting that particular page to "pass on" the variables again to the next page but I'm having no luck. Any guidance would be appreciated. Thanks in advance.
  14. Hi. I've just managed to get a flash mp3 player preview working for my music site. The only problem is, at the moment there are 669 results returned on one page. So 670 flash objects are loaded at once! How can I introduce pagenation to an array of returned results? I want to limit results to say, 50 per page, whilst having the ability to move to the next and previous page, etc. Does anyone have a snippet or something that will start me going? The page in question can be seen at http://m.bridgey.net/indexn.php but I wouldn't click it unless you have a decent PC / net connection! Source code follows:- <?php include ("mcount.php"); function sortByDate($b, $a) { if ($a['dateSort'] == $b['dateSort']) { return 0; } return ($a['dateSort'] < $b['dateSort'])? -1 : 1; } //Valid extensions $valid_extensions = array ('mp3', 'wma'); $path = '.'; $dirArray = array(); // set timezone to GMT for all time fields putenv("TZ=GB/GMT"); // open dir $myDirectory = opendir($path); // fetch entries while($fileName = readdir($myDirectory)) { //Only process files if (!is_dir($path.'/'.$fileName)) { //Only process files with valid extensions $ext = strtolower(array_pop(explode(".", ($fileName)))); if (in_array($ext, $valid_extensions)) { $fileIdx = count($dirArray); $size = filesize($fileName); $totalSize += $size; $dirArray[$fileIdx]['name'] = $fileName; $dirArray[$fileIdx]['ext'] = $ext; $dirArray[$fileIdx]['dateSort'] = date('YmdHi', filemtime($fileName)); $dirArray[$fileIdx]['date'] = date('d/m/Y @ H:i', filemtime($fileName)); $dirArray[$fileIdx]['size'] = round((filesize($fileName) / 1024 / 1024), 2); } } } $sizecount = round(($totalSize/ 1024 / 1024), 2); $sizecountgb = round(($totalSize/ 1024 / 1024 / 1024), 2); // close dir closedir($myDirectory); //Sort by key usort($dirArray, 'sortByDate'); echo "<font face=verdana size=3 color=#F8F304><B>"; echo ":: To download right click on a track and 'save as...'</B><br>\n"; echo ":: To upload click the link at the top-right.</font><br>\n"; echo "<p align=\"center\"><font face=verdana size=2 color=white><b>Stats:</b> There are currently a total of <b>" . count($dirArray) . "</b> tracks here, totalling <b>" . $sizecount . " MB</b> in size <i>(which is about ". $sizecountgb ." GB). <b>". $hits[0] ."</b> of you have been here since Aug '08..</i></font></p><p align=\"center\"><font face=tahoma size=3 color=white>Hit Control + F to search - <a style=\"color:white\" href=\"javascript:bookmarksite('Bangin Trance, House & Electronica Tracks @ Bridgey.net', 'http://m.bridgey.net')\">Click here to add to bookmarks/favourites</a></font><br><br>\n"; // print header row echo "<center>\n"; echo "<table width=\"98%\" border=\"1\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#183041\">\n"; echo "<tr align=\"left\" background=\"http://bridgey.net/img/row_bg.gif\">\n"; echo "<th align=\"left\">Name / Preview</th>\n"; echo "<th align=\"center\">Type</th>\n"; echo "<th align=\"center\">File Size</th>\n"; echo "<th align=\"center\">Date Added</th>\n"; //echo "<th align=\"center\">Download?</th>\n"; echo "</tr>\n"; // print results foreach ($dirArray as $file) { echo "<tr background=\"http://bridgey.net/img/row_bg.gif\">\n"; echo "<td align=\"left\" background=\"http://bridgey.net/img/row_bg.gif\">"; echo "<font face=\"verdana\" size=\"2\" color=\"#D9F4FD\"><b> "; echo "<a href=\"{$file['name']}\"><img src=\"http://www.bridgey.net/img/star.gif\" border=\"0\">"; echo $file['name'] . "</a></b></font><br><object type=\"application/x-shockwave-flash\" data=\"http://bridgey.net/joomla/mambots/content/wp_player.swf\" id=\"audioplayer2\" width=\"290\" height=\"24\"><param name=\"movie\" value=\"http://bridgey.net/joomla/mambots/content/wp_player.swf\"><param name=\"FlashVars\" value=\"playerID=1&soundFile= {$file['name']}&autostart=no\"><param name=\"quality\" value=\"high\"><param name=\"menu\" value=\"false\"><param name=\"wmode\" value=\"transparent\"></object></td>\n"; echo "<td align=\"center\" background=\"http://bridgey.net/img/row_bg.gif\">{$file['ext']}</td>\n"; echo "<td align=\"center\" background=\"http://bridgey.net/img/row_bg.gif\">{$file['size']} " . MB ."</td>\n"; echo "<td align=\"center\" background=\"http://bridgey.net/img/row_bg.gif\">{$file['date']}</td>\n"; //echo "<td align=\"center\" background=\"http://bridgey.net/img/row_bg.gif\"><form name=\"download\" method=\"post\" action=\"download.php\"><input name=\"fileName\" type=\"hidden\" value=\"http://bridgey.net/music/{$file['name']}\"><input type=\"submit\" name=\"DL\" id=\"DL\" value=\"DL\" style=\"border:none #000000; background-color:#0099FF; outline:none; text-align:center; font-family:tahoma; font-size:14px\" /></form></td>\n"; echo "</tr>\n"; } echo "</table>\n"; echo "</center><br clear=\"all\">\n"; ?>
  15. Hi I've been trying to use javascript to show a hidden span containing instructions when a form is submitted with no luck so far.. Basically when the form is submitted, onclick should run a couple of functions, one sets the button text to read something else and the other should show instructions hidden in a span with style="display:none". The button is renamed on clicking, but I cannot get the hidden span to show up. What am I doing wrong? I've tried various things including trying to get function remoteConnect() to unhide the span or getting it to run function showSpan(answer1).. Button:- <input name="submit" type='submit' class="connectbutton" style="border: 1px groove rgb(0, 0, 0); text-align: center; background-color:#FFCC00; width:200px" value='Connect to Support' onclick="remoteConnect(); showSpan('answer1'); return false;" /> Javascript:- <script language="JavaScript"> function remoteConnect() { document.channel296606886.submit.value = 'Loading.. Please wait..'; document.channel296606886.submit(); } </script> <script language="JavaScript"> function showSpan(id) { document.getElementById(id).style.display = 'block'; } </script> Hidden Span:- <span id="answer1" style="display:none"> <p class="boxontop style15 style16 style17">Select 'Open' followed by 'Run' when prompted</p> </span>
  16. I have no idea why I'm using this one.. I usually use bridgey, or a variation of, as that's my nickname. To be honest I probably didn't think I'd be sticking around much so put in anything ["Scott" was probably taken :)]. Y'know how many forums you sign up to these days eh ;)
  17. When download.php just echos $fileName, the result is correct, I think: Storm - Storm [Housetrap Remix].mp3. As you can see it's formatted correctly for humans, no %20's or anything.. I'm not sure whether that is the result the script is returning or whether my browser just turned %20's into spaces for me.. Also if I use the following to try to specify the full location, the file that the browser attempts to download is called http__bridgey.net_music_Storm header("Content-Disposition: attachment; filename=http://bridgey.net/music/".basename($fileName)); I wouldn't of thought this was necessary anyway, as download.php and all files that could be downloaded live in the same folder on the server? Correct me if I'm wrong I'm learning here
  18. Oh and ignore the HTML disabled=true.. I've put that in since. Example file name: http://bridgey.net/music/Storm%20-%20Storm%20%5BHousetrap%20Remix%5D.mp3# Resulting download:-
  19. Hi. I'm trying to convert from using plain old HTML hyperlinks to using PHP to pass a file name to download.php. The problem is the download script passes a file to the browser which is not the complete file name and extension, so the file is not an actual copy of the file on the server.. I don't understand how this is not working, as the same variable {$file['name']} is displayed fine on the page, with the full file name and extension. I suspect that when the variable is passed over to download.php, spaces in file names are interfering, but I need code around this as file names will most likely always contain spaces. Code: echo "<td align=\"center\" background=\"http://bridgey.net/img/row_bg.gif\"><form name=\"download\" method=\"post\" action=\"download.php\"><input name=\"fileName\" type=\"hidden\" value=\"{$file['name']}\"><input type=\"submit\" disabled=\"true\" name=\"Download\" id=\"Download\" value=\"Download\" /></form></td>\n"; Download.php: <?php $fileName = $_POST['fileName']; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=".basename($fileName)); header("Content-Description: File Transfer"); header("Accept-Ranges: bytes"); header("Content-Length: " . filesize($fileName)); @readfile($fileName); ?> Any input would be appreciated. Many thanks.
  20. Thank you - that's all it was - the capitalization of delFile has resolved the problem
  21. Thank you for your feedback. New code based on your input, and something I thought was worth trying, which still doesn't work:- Uploaded.php: <?php function sortByDate($b, $a) { if ($a['dateSort'] == $b['dateSort']) { return 0; } return ($a['dateSort'] < $b['dateSort'])? -1 : 1; } //Valid extensions $valid_extensions = array ('xls', 'zip', 'pdf', 'csv', 'txt', 'doc', 'jpeg', 'png', 'jpg', 'gif', 'rar', 'xlsx', 'docx', 'bak', '001', 'rtf', 'mak', 'ini', 'sgc', 'sly', 'xml', 'vbs', 'bmp', 'htm'); $path = '.'; $dirArray = array(); // set timezone to GMT for all time fields putenv("TZ=GB/GMT"); // open dir $myDirectory = opendir($path); // fetch entries while($fileName = readdir($myDirectory)) { //Only process files if (!is_dir($path.'/'.$fileName)) { //Only process files with valid extensions $ext = strtolower(array_pop(explode(".", ($fileName)))); if (in_array($ext, $valid_extensions)) { $fileIdx = count($dirArray); $size = filesize($fileName); $totalSize += $size; $dirArray[$fileIdx]['name'] = $fileName; $dirArray[$fileIdx]['ext'] = $ext; $dirArray[$fileIdx]['dateSort'] = date('Ymdhi', filemtime($fileName)); $dirArray[$fileIdx]['date'] = date('d/m/Y @ H:i', filemtime($fileName)); $dirArray[$fileIdx]['size'] = round((filesize($fileName) / 1024 / 1024), 2); } } } $sizecount = round(($totalSize/ 1024 / 1024), 2); $sizecountgb = round(($totalSize/ 1024 / 1024 / 1024), 2); // close dir closedir($myDirectory); //Sort by key usort($dirArray, 'sortByDate'); echo "<p><font face=verdana size=4 color=#016E6B><B>"; echo "To download right click on a file and 'save as...'<br>\n"; echo "If the file is an image, you can left click on it to view it in the browser.</B></font></p><br>\n"; echo "<p class=\"box2\"<font face=verdana size=3 color=#045856>Current File Count: <b>" . count($dirArray) . "</b><br>\n"; echo "Current Total Size: <b>" . $sizecount . " MB</b> <i>(". $sizecountgb . " GB)</i></font></p><br>\n"; // print header row echo "<center>\n"; echo "<table width=\"98%\" border=\"1\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#016E6B\">\n"; echo "<tr align=\"left\" background=\"http://centurysoftware.co.uk/img/Crow_bg2.gif\">\n"; echo " <th align=\"left\">File Name</th>\n"; echo " <th align=\"center\">Type</th>\n"; echo " <th align=\"center\">Size</th>\n"; echo " <th align=\"center\">Date/Time Uploaded</th>\n"; echo " <th align=\"center\">Delete?</th>\n"; echo "</tr>\n"; // print results foreach ($dirArray as $file) { echo "<tr background=\"http://centurysoftware.co.uk/img/Crow_bg.gif\">\n"; echo " <td align=\"left\" background=\"http://centurysoftware.co.uk/img/Crow_bg.gif\">"; echo "<font face=\"verdana\" size=\"2\" color=\"#D9F4FD\"><b> "; echo "<a href=\"{$file['name']}\"><img src=\"http://centurysoftware.co.uk/img/Cstar.gif\" border=\"0\">"; echo $file['name'] . "</a></b></font></td>\n"; echo " <td background=\"http://centurysoftware.co.uk/img/Crow_bg.gif\" align=\"center\">{$file['ext']}</td>\n"; echo " <td background=\"http://centurysoftware.co.uk/img/Crow_bg.gif\" align=\"center\">{$file['size']} " . MB ."</td>\n"; echo " <td background=\"http://centurysoftware.co.uk/img/Crow_bg.gif\" align=\"center\">{$file['date']}</td>\n"; echo " <td background=\"http://centurysoftware.co.uk/img/Crow_bg.gif\" align=\"center\"><form name=\"del\" method=\"post\" action=\"delFile.php?delFile={$file['name']}\"><input name=\"delfile\" type=\"hidden\" value=\"{$file['name']}\"><input type=\"submit\" name=\"X\" id=\"X\" value=\"X\" /></form></td>\n"; echo "</tr>\n"; } echo "</table>\n"; echo "</center><br clear=\"all\">\n"; ?> delFile.php <?php $delFile = $_POST['delFile']; unlink("$delFile"); //echo("<center><br><br><b>File: ". $delFile ." has been deleted.</b><br><br>"); echo("<br><br><br>Done. <a href=uploaded.php>Go back?<a></center>"); ?> Any suggestions would be appreciated
×
×
  • 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.