Jump to content

HuggieBear

Members
  • Posts

    1,899
  • Joined

  • Last visited

Everything posted by HuggieBear

  1. It's called a breadcrumb. Regards Huggie
  2. You should be able to see it inside the function, but not outside. If your if statement, and your echo statement are both inside the function, then yes it should be echoed. Regards Huggie
  3. Is there something above this line in the code? $result = $db->getallisland(); Regards Huggie
  4. It's probably a constant. <?php define('YOUR_CONSTANT', "This is my constant, it doesn't change"); echo YOUR_CONSTANT; ?> Regards Huggie
  5. There must be some more php code somewhere else. Further up the page maybe, if it doesn't look like it then maybe something like this: <?php include('something.php'); ?> Or <?php require('something.php'); ?> That's the code we'd need to see. Regards Huggie
  6. Sure, call it what you like. Just make sure you map the value in php with something like this (Using 'All' as my value): <?php $sql = "SELECT * FROM table_name"; if ($_POST['dropdown'] != "All"){ $sql .= " WHERE area = '" . $_POST['dropdown'] . "'"; } ?> Regards Huggie
  7. There's probably a neater way of doing this, but I'd go with this: <?php // Array of timings to pass in to function $times[] = "26"; $times[] = "25.5"; $times[] = "24"; $times[] = "14"; // Call to function $secs = SecondDelay($times); // Print out each timing difference in 'seconds' foreach ($secs as $t){ echo $t . "<br>"; } // Funtion takes an unordered array of times and returns an ordered array of differences function SecondDelay($timings){ rsort($timings, SORT_NUMERIC); $highest = $timings[0]; foreach ($timings as $time){ $diff = floatval($highest - $time); $sdiff = $diff * 2; $seconds[] = '+' . $sdiff . 's'; } return $seconds; } ?> If you want it to return the differences in the order you pass them to the function, then I can change that. Hope this helps. Regards Huggie
  8. You can't use isset(). As you have a default value in the field, it will always be set you'll need to use: <?php if(($day == "- Day -") && ($month == "- Month -") && ($year == "- Year -")) { $day=""; $month=""; $year=""; } ?> Regards Huggie
  9. You could export the excel spreadsheet as a CSV file then use fgetcvs() or alternatively you could probably use COM objects. Regards Huggie
  10. Check out the Variable Parsing in the PHP manual for a better understanding. It covers both simple and complex (curly) syntax. Regards Huggie
  11. No problem, glad to have been of some assistance. Regards Huggie
  12. Attached is the finished file with the altered GetSortcode() function too. Regards Huggie [attachment deleted by admin]
  13. OK, in that case try this: <html> <head> <title>Postcode Anywhere Bank Details Validation</title> </head> <body> <?php /* Note: This script has been developed for .php version 4.2.3. .php version 4.3 has more options to parse xml properly with slightly modified functions. This script will validate a bank sort number and an account number. Both are needed for the sample to work. If only sortcode validation is required then the GetBank method should be used instead of Validate */ // enter you account code and license key $ACCOUNTCODE = "xxxx"; $LICENSEKEY = "xxxx"; // values entered are posted back for processing $SortCode = $_POST['sortcode']; $AccountNumber = $_POST['accountnumber']; function ValidateBank($SortCode, $AccountNumber){ global $ACCOUNTCODE,$LICENSEKEY; /* Build up the URL to send the request to. */ $sURL = "http://services.postcodeanywhere.co.uk/csv.aspx?"; $sURL .= "account_code=" . urlencode($ACCOUNTCODE); $sURL .= "&license_code=" . urlencode($LICENSEKEY); $sURL .= "&action=bacs_validate"; $sURL .= "&sortcode=" . urlencode($SortCode); $sURL .= "&accountnumber=" . urlencode($AccountNumber); $data = PrepareData($sURL); return $data; } function GetSortcode ($SortCode){ global $ACCOUNTCODE,$LICENSEKEY; /* Build up the URL to send the request to. */ $sURL = "http://services.postcodeanywhere.co.uk/csv.aspx?"; $sURL .= "account_code=" . urlencode($ACCOUNTCODE); $sURL .= "&license_code=" . urlencode($LICENSEKEY); $sURL .= "&action=bacs_fetch"; $sURL .= "&sortcode=" . urlencode($SortCode); $data = PrepareData($sURL); return $data; } function PrepareData($filetoopen) { $handle = fopen($filetoopen, "r"); while ($row = fgetcsv($handle, 1000)){ $data[] = $row; } fclose($handle); return $data; } ?> <h1>Bank Validation</h1> <form method="POST" action="bank_validation.php"> <?php // If the sortcode and account number have been entered they are validated if (isset($SortCode) && !empty($AccountNumber)) { $data = ValidateBank($SortCode, $AccountNumber); echo "<table>\n"; foreach ($data as $k => $v){ if ($k != 0){ $name = $data[$k][5]; $branch = $data[$k][6]; $ok = $data[$k][23]; echo "<tr>\n"; echo "<td>Name</td><td>$name</td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td>Branch</td><td>$branch</td>\n"; echo "</tr>\n"; if ($ok == TRUE) { echo "<tr>\n"; echo "<td colspan=2>Account number validated OK</td>\n"; echo "</tr>\n"; } else { echo "<tr>\n"; echo "<td colspan=2>Account number not valid</td>\n"; echo "</tr>\n"; } } } echo "</table>"; } //elseif only the sortcode has been entered, the bank address is returned elseif (empty($AccountNumber) && !empty($SortCode)) { $data = GetSortcode($SortCode); echo "<table>\n"; foreach ($data as $keyd => $data) { $name = $data["name"]; $branch = $data["branch"]; echo "<tr>\n"; echo "<td>Name</td><td>$name</td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td>Branch</td><td>$branch</td>\n"; echo "</tr>\n"; echo "</table>"; } } //else neither of the sortcode or account number have been entered, the form is simply displayed again else { echo "<p>Enter a sortcode and account number below and click on the 'Validate' button to check the details.</p> <P>Alternatively, just enter a sortcode and the bank address details will be returned</p>\n"; echo "Sortcode: <input name=\"sortcode\" id=\"sortcode\" value=\"\" type=\"text\" size=\"6\">\n"; echo "Account number: <input name=\"accountnumber\" id=\"accountnumber\" value=\"\" type=\"text\" size=\"10\">\n"; echo "<input id=\"btnValidate\" type=\"submit\" value=\"Validate\">\n"; } ?> </form> </body> </html>
  14. OK, if you open the CSV file, does it say True or TRUE? Regards Huggie
  15. Retry with this: <html> <head> <title>Postcode Anywhere Bank Details Validation</title> </head> <body> <?php /* Note: This script has been developed for .php version 4.2.3. .php version 4.3 has more options to parse xml properly with slightly modified functions. This script will validate a bank sort number and an account number. Both are needed for the sample to work. If only sortcode validation is required then the GetBank method should be used instead of Validate */ // enter you account code and license key $ACCOUNTCODE = "xxxx"; $LICENSEKEY = "xxxx"; // values entered are posted back for processing $SortCode = $_POST['sortcode']; $AccountNumber = $_POST['accountnumber']; function ValidateBank($SortCode, $AccountNumber){ global $ACCOUNTCODE,$LICENSEKEY; /* Build up the URL to send the request to. */ $sURL = "http://services.postcodeanywhere.co.uk/csv.aspx?"; $sURL .= "account_code=" . urlencode($ACCOUNTCODE); $sURL .= "&license_code=" . urlencode($LICENSEKEY); $sURL .= "&action=bacs_validate"; $sURL .= "&sortcode=" . urlencode($SortCode); $sURL .= "&accountnumber=" . urlencode($AccountNumber); $data = PrepareData($sURL); return $data; } function GetSortcode ($SortCode){ global $ACCOUNTCODE,$LICENSEKEY; /* Build up the URL to send the request to. */ $sURL = "http://services.postcodeanywhere.co.uk/csv.aspx?"; $sURL .= "account_code=" . urlencode($ACCOUNTCODE); $sURL .= "&license_code=" . urlencode($LICENSEKEY); $sURL .= "&action=bacs_fetch"; $sURL .= "&sortcode=" . urlencode($SortCode); $data = PrepareData($sURL); return $data; } function PrepareData($filetoopen) { $handle = fopen($filetoopen, "r"); while ($row = fgetcsv($handle, 1000)){ $data[] = $row; } fclose($handle); return $data; } ?> <h1>Bank Validation</h1> <form method="POST" action="bank_validation.php"> <?php // If the sortcode and account number have been entered they are validated if (isset($SortCode) && !empty($AccountNumber)) { $data = ValidateBank($SortCode, $AccountNumber); echo "<table>\n"; foreach ($data as $k => $v){ if ($k != 0){ $name = $data[$k][5]; $branch = $data[$k][6]; $ok = $data[$k][23]; echo "<tr>\n"; echo "<td>Name</td><td>$name</td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td>Branch</td><td>$branch</td>\n"; echo "</tr>\n"; if ($ok == "True") { echo "<tr>\n"; echo "<td colspan=2>Account number validated OK</td>\n"; echo "</tr>\n"; } else { echo "<tr>\n"; echo "<td colspan=2>Account number not valid</td>\n"; echo "</tr>\n"; } } } echo "</table>"; } //elseif only the sortcode has been entered, the bank address is returned elseif (empty($AccountNumber) && !empty($SortCode)) { $data = GetSortcode($SortCode); echo "<table>\n"; foreach ($data as $keyd => $data) { $name = $data["name"]; $branch = $data["branch"]; echo "<tr>\n"; echo "<td>Name</td><td>$name</td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td>Branch</td><td>$branch</td>\n"; echo "</tr>\n"; echo "</table>"; } } //else neither of the sortcode or account number have been entered, the form is simply displayed again else { echo "<p>Enter a sortcode and account number below and click on the 'Validate' button to check the details.</p> <P>Alternatively, just enter a sortcode and the bank address details will be returned</p>\n"; echo "Sortcode: <input name=\"sortcode\" id=\"sortcode\" value=\"\" type=\"text\" size=\"6\">\n"; echo "Account number: <input name=\"accountnumber\" id=\"accountnumber\" value=\"\" type=\"text\" size=\"10\">\n"; echo "<input id=\"btnValidate\" type=\"submit\" value=\"Validate\">\n"; } ?> </form> </body> </html> Regards Huggie
  16. Simon, Try this: <html> <head> <title>Postcode Anywhere Bank Details Validation</title> </head> <body> <?php /* Note: This script has been developed for .php version 4.2.3. .php version 4.3 has more options to parse xml properly with slightly modified functions. This script will validate a bank sort number and an account number. Both are needed for the sample to work. If only sortcode validation is required then the GetBank method should be used instead of Validate */ // enter you account code and license key $ACCOUNTCODE = "xxxx"; $LICENSEKEY = "xxxx"; // values entered are posted back for processing $SortCode = $_POST['sortcode']; $AccountNumber = $_POST['accountnumber']; function ValidateBank($SortCode, $AccountNumber){ global $ACCOUNTCODE,$LICENSEKEY; /* Build up the URL to send the request to. */ $sURL = "http://services.postcodeanywhere.co.uk/csv.aspx?"; $sURL .= "account_code=" . urlencode($ACCOUNTCODE); $sURL .= "&license_code=" . urlencode($LICENSEKEY); $sURL .= "&action=bacs_validate"; $sURL .= "&sortcode=" . urlencode($SortCode); $sURL .= "&accountnumber=" . urlencode($AccountNumber); PrepareData($sURL); } function GetSortcode ($SortCode){ global $ACCOUNTCODE,$LICENSEKEY; /* Build up the URL to send the request to. */ $sURL = "http://services.postcodeanywhere.co.uk/csv.aspx?"; $sURL .= "account_code=" . urlencode($ACCOUNTCODE); $sURL .= "&license_code=" . urlencode($LICENSEKEY); $sURL .= "&action=bacs_fetch"; $sURL .= "&sortcode=" . urlencode($SortCode); PrepareData($sURL); } function PrepareData($filetoopen) { $handle = fopen($filetoopen, "r"); while ($row = fgetcsv($handle, 1000)){ $data[] = $row; } fclose($handle); } ?> <h1>Bank Validation</h1> <form method="POST" action="bank_validation.php"> <?php // If the sortcode and account number have been entered they are validated if (isset($SortCode) && !empty($AccountNumber)) { ValidateBank($SortCode, $AccountNumber); echo "<table>\n"; foreach ($data as $k => $v){ if ($k != 0){ $name = $data[$k][5]; $branch = $data[$k][6]; $ok = $data[$k][23]; echo "<tr>\n"; echo "<td>Name</td><td>$name</td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td>Branch</td><td>$branch</td>\n"; echo "</tr>\n"; if ($ok == "True") { echo "<tr>\n"; echo "<td colspan=2>Account number validated OK</td>\n"; echo "</tr>\n"; } else { echo "<tr>\n"; echo "<td colspan=2>Account number not valid</td>\n"; echo "</tr>\n"; } } } echo "</table>"; } //elseif only the sortcode has been entered, the bank address is returned elseif (empty($AccountNumber) && !empty($SortCode)) { GetSortcode($SortCode); echo "<table>\n"; foreach ($data as $keyd => $data) { $name = $data["name"]; $branch = $data["branch"]; echo "<tr>\n"; echo "<td>Name</td><td>$name</td>\n"; echo "</tr>\n"; echo "<tr>\n"; echo "<td>Branch</td><td>$branch</td>\n"; echo "</tr>\n"; echo "</table>"; } } //else neither of the sortcode or account number have been entered, the form is simply displayed again else { echo "<p>Enter a sortcode and account number below and click on the 'Validate' button to check the details.</p> <P>Alternatively, just enter a sortcode and the bank address details will be returned</p>\n"; echo "Sortcode: <input name=\"sortcode\" id=\"sortcode\" value=\"\" type=\"text\" size=\"6\">\n"; echo "Account number: <input name=\"accountnumber\" id=\"accountnumber\" value=\"\" type=\"text\" size=\"10\">\n"; echo "<input id=\"btnValidate\" type=\"submit\" value=\"Validate\">\n"; } ?> </form> </body> </html> I've only altered the ValidateBank() function and the PrepareData() function. So if they work OK then I'll alter the GetSortcode() function too. Regards Huggie
  17. OK, I'll get back to you. Regards Huggie
  18. I might have it, back shortly. Regards Huggie
  19. Is $Data actually an array? Regards Huggie
  20. I think that's what I'll end up going with. TinyMCE with my site's stylesheet should be OK. Regards Huggie
  21. OK, say I went for an all singing all dancing CMS like Joomla, how easy would it be to create a UI/skin for it that reflected my design? Regards Huggie
  22. I'm after suggestions for a CMS to use with an existing design. Here's what the site looks like: Pulse I guess CMS is probably a little too grand for what I want. I just want to be able to update the text on each of my pages without editing the design. I've implemented solutions like TinyMCE before and think it's an ideal editor to use, but I need to be able to integrate this with something that can handle the content. Regards Huggie
  23. Try changing this: $check_query = mysql_query("SELECT * FROM user_info WHERE username = {$login_username} and WHERE password = {$login_pw}"); To this: $sql = "SELECT * FROM user_info WHERE username = '" . $login_username . "' AND password = '" . $login_pw . "'"; $check_query = mysql_query($sql); if (!$check_query){ echo "Failed to execute query ($sql): " . mysql_error(); } Regards Huggie
  24. Is all the information being entered into the HTML table underneath OK? Regards Huggie
  25. Have you read the PHP manual on Comparison Operators? Are your operands of the same type? Regards Huggie
×
×
  • 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.