Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Love2c0de last won the day on January 2 2013

Love2c0de had the most liked content!

About Love2c0de

  • Birthday 05/03/1989

Contact Methods

  • Website URL
  • Skype

Profile Information

  • Gender
  • Location
    The Pleiades
  • Interests
    Coding, Money
  • Age

Love2c0de's Achievements

Regular Member

Regular Member (3/5)



  1. Good morning, I have a wordpress theme I am using and I thought all was working well. I've noticed that when I'm not logged into admin, it doesn't show any pages for me, only white pages. When I switched back to the default TwentyTwelve theme, it worked all ok for me. Has anyone had this problem before? Thanks for your time. Kind regards, L2c
  2. Good afternoon, How would I handle inserting checkboxes into a mysql database? I have a form which has a list of services in checkbox format as well as other fields and I want to save the values to a database but I want to be able to query the database by service if needs be. How do I deal with multiple services from checkboxes? Would I create another table called 'services' for example with columns - 'service1','service2','service3' etc etc and a unique id relating to my contact table? Thank you for your help. Kind regards, L2c
  3. Good evening, I've just validated a form with jQuery/JavaScript and I'm looking to basically do the same validation with PHP. I'm starting off by trimming all of the fields, then I'm going to check the required fields to see if they are empty or not. If so I want to send them back to the page but I need to display the errors next to the specific input fields and I'm not sure how to do it. I understand im going to have to save the error array into a session and then print the values, but I'm not sure how to map them to the correct input field. Can anyone help me? Here is my JavaScipt: $( "#reg-form" ).submit(function(e) { $('.arrow_box').css("display","none"); //hold required field values var reqFields = new Array(); //holds indexes of empty required fields var emptyInputs = new Array(); //holds form controls and will match up with emptyInputs array to determine which error box to show var formControls = new Array(); //get the value from all required fields $('.required').each(function(){ reqFields.push($(this).val()); }); //trim each required field and push any empty fields into the emptyInputs array $.each(reqFields, function(key,value){ if($.trim(value) == "") { emptyInputs.push(key); } }); //get all error divs $('.arrow_box').each(function(){ formControls.push($(this)); }); if(emptyInputs.length > 0) { e.preventDefault(); //get values from emptyInputs to determine the index of the formControls to show $.each(emptyInputs, function(k,v){ $(formControls[v]).css("display","block").prev('input').focus(); }); $(formControls[emptyInputs[0]]).prev('input').focus(); } else { //continue in-depth validation on each specific field var fname = $('#fname'); var lname = $('#lname'); var email = $('#email'); var dob = $('#dob'); var mphone = $('#mphone'); var wphone = $('#wphone'); var ages = $('#ages'); var nameRegExp = /^[a-zA-Z\s]*$/; var numRegExp = /\d+/g; var emailRegExp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; if(!nameRegExp.test($(fname).val())) { emptyInputs.push($(fname).next()); } if(!nameRegExp.test($(lname).val())) { emptyInputs.push($(lname).next()); } if(!emailRegExp.test($(email).val())) { emptyInputs.push($(email).next()); } if(!dob.val().match(numRegExp)) { emptyInputs.push($(dob).next()); } if(!mphone.val().match(numRegExp)) { emptyInputs.push($(mphone).next()); } if(!wphone.val().match(numRegExp)) { emptyInputs.push($(wphone).next()); } if(!ages.val().match(numRegExp)) { emptyInputs.push($(ages).next()); } if(emptyInputs.length > 0) { $(emptyInputs).each( function(k,v){ $(this).css("display","block"); }); $(emptyInputs[0]).prev('input').focus(); e.preventDefault(); } else { return true; } } }); Here is my PHP so far: <?php if(isset($_POST['fname'])) { $errors = array(); $required = array($_POST['fname'], $_POST['lname'], $_POST['dob'], $_POST['mphone'], $_POST['wphone'], $_POST['address'], $_POST['city'], $_POST['province'], $_POST['ages']); foreach($required as $k => &$v) { $v = trim($v); if(empty($v)) { array_push($errors, true); } else { array_push($errors, false); } } if(in_array(true, $errors, true)) { $_SESSION['msg'] = $errors; header("Location: Register-Now.php"); die(); } echo "<pre>"; var_dump($errors); echo "</pre>";die(); } else { //someone has tried to directly access the form script without a submit, send them back! header("Location: Register-Now.php"); die(); } ?> Really stuck, can anyone help me with this problem? Thank you for your time. Kind regards, L2c.
  4. Hi Denno, Thanks for the reply and advice. So it wouldn't actually be an <input> with the type of hidden but an <input> with the type of text with a CSS declaration of display:none? I've just used that technique but used an <input> with type hidden. I suppose it would have to be of type text in order for a bot to be able to fill it in? Not sure how bots work! Kind regards, Tom
  5. Good morning, I have a captcha on my website but for some reason within the last day everytime the page loads it automatically focuses on the captcha input field. I've found a couple things on the net of someone with the same issue but I can't seem to resolve it. Captcha is an ugly little thing anyway and wondered if there are any alternatives out there? I've seen forms asking to find the sum of 2 numbers but not sure how secure that is from bots. Thank you very much for your time. Kind regards, L2c
  6. Hi Ch0cu3r, Thank you for the reply and sorry for the late reply. I ended up taking another route. I did look at the link you provided but it was too complicated at the time. Would you be able to help me solve my next problem? I used this code to get what I needed: RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME}.php -fRewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [L] I have a 'portfolio.php' page with some project links. When those links are clicked it accepts a GET variable and pulls the relevant information from the database - displaying it on 'project.php'. So project.php acts as a template for different content. How can I modify my .htaccess rules to compensate for when there is a GET variable passed? Thank you for your time. Kind regards, Tom
  7. Good afternoon, I'm having a really weird problem with my attempt at re-writing URL's. I'm trying to remove the .php extension from my filename within the URL. It works fine with pages 'portfolio.php, terms.php and promise.php' but not any of the other pages. The other pages send me to a redirect loop error. Here is my rewrite rules: RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME}.php -fRewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [L] filenames are as guessed, index.php, services.php, contact.php etc, as you can see only those certain pages listed above work. Does anyone know why? Thank you for your time. Kind regards, L2c
  8. Good evening, I've got a client who wants to add another 'shop' page to their website. Their website is already using OpenCart and they are happy to use the same Cart for both sets of products. so I just need another page with a different set of products - but integrated into OpenCart. If you would like to discuss further about price etc, please contact me here or on Skype: thomas_c0de Regards, Tom
  9. Good morning, I need to validate a US phone number and wanted to know some basic facts such as max/max amount of digits possible etc. I know it can be validated with a regexp but just looking to do some simple tests on the data before inserting to a db. Even if you could link me to a proven, reliable online resource that would be great. Thanks for your time and help. Kind regards, L2c.
  10. Get in there, I've figured it out! Regards, L2c
  11. Ok, so what I've done is wrote the link as such: <a href="./PropertyOwners/owner-specials">Owner Specials</a> With my .htaccess looking like: RewriteEngine on RewriteRule ^/?([a-zA-Z-]+)$ index.php?page=$1 [L,QSA] RewriteRule ^([a-zA-Z-]+)/([a-zA-Z]+)/?$ index.php?page=$1&category=$2 [L] Now, this works perfectly for my links which are top-level links such as: <a href="./contact">Contact</a> but when I try adding the extra $_GET variable, it doesn't work - I get a 404 error. I've tried changing the second RewriteRule in my .htaccess so that the 'page' $_GET variable is at the very end of the URL with 'category' being the first $_GET in the URL - followed by the filename. Really at a loss. Is it because of the QSA - append flag? Thanks for your time. Kind regards, L2c.
  12. Good afternoon, Following on, I've got the site nearly made now. The same as above but I have put all content template files into one main folder. I'm not sure how I am going to target the pages to know which 'directory' to add. For example 'Who We Are' needs to be written as www.mysite.com/About/Who-We-Are but how am I going to target that dynamically for the other pages? I thought about hardcoding it in the anchor tags such as: <ul> <li><a href="#">About Us</a> <ul> <li><a href="./About/Who-We-Are">Who we are</a></li> //etc //etc <ul> </li> </ul> Is this something I can control with .htaccess? If so I still need a way to determine which value to put in place of 'About' as I have 2 other links with a sublevel menu. It's seeming easier to just put the individual related template files into the corresponding directory within my main template directory such as: [content] [about] who-we-are.tpl our history.tpl [activities] nc-culture.tpl nc-entertainment.tpl nc-sports-and-recreation.tpl etc etc That way I just need to control the filename part of the url with .htaccess. What do you guys think? Kind regards, L2c.
  13. I found out a little more about the software the company use, it's called 'Appfolio' - http://www.appfolio.com/ Anyone ever worked with this in a PHP website? Going to speak to the client and find out more about how they transfer the properties into the website. He said they use ASP scripts to do it but this looks more like software where you would literally put the required data into some kind of structure, then upload it to the site somehow. Kind regards, L2c.
  14. Good evening, My client wants sub menus within the navigation like the format below: Home Avaliable Rentals Property Owner Owner Services owner specials Owner FAQ Owner Contact About us Who we are what we do our history Our services Owner Services Tenant Services About Florida Florida NC Florida activites Florida Schools Florida Parks and recreation Florida restraunts Florida Entertainment Florida health care HOA Management Contact US I'm going to do a breadcrumb effect and they also want the URL to look like: www.theirsite.com/About/FloridaHealthCare so I'm going to rewrite the URL. What is the best way to store my HTML template files (the sub level links above)? I've got a main directory where they are called 'content'. Within that should I create the other directories such as 'About', 'PropertyOwner', 'Services' etc and then have my actual template files within the relative directories? Or should I just keep all template files in one main folder and write the sub directory via code? I'm thinking to create the directories within 'content' and put the files in the relevant ones as it would automatically write that part of the URL for me but I want to know what the standard is. Thanks for your time. Kind regards, L2c.
  15. @Ch0c - It's purely because I can't code in ASP. I did a quick static website for someone and they want me to re-do their other website, which is a Real Estate company, so I'm looking to build the site in PHP as it's the only server side language I know. @trq - That's great, I'll look into that! I'm considering a CMS for them to be able to add/delete/edit property details so they don't have to use ASP at all. Kind regards, L2c.
  • 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.