Jump to content
Killersites Forums

KJ

Member
  • Posts

    13
  • Joined

  • Last visited

KJ's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I've spent a few week renewing my PHP for a form I use on my son's Web site. I'm pleased to say the form functions fine in every way, but I would prefer that the 'Accept privacy policy' checkbox (at the foot of the form), validates only after all the other validation has passed. Currently if any mistakes are made by the user when completing the form, the 'privacy' checkbox error tiles beneath any other errors, which is to be expected with the current script. I've been trying to figure out a function which will allow all the form fields to validate and only then would the 'privacy' field validation to kick in. I've spent hours trying to figure out a solution, but to no avail, though I'm sure there is one. Any and all help will be VERY MUCH appreciated. Very pleased to report that I've managed to solve the problem and the form now functions as desired. Thank you! to the 69 who viewed the post and possibly considered a solution.
  2. THANK YOU!!!! Andrea I'll get on to it asap. I do this purely out of interest in the Web and for fun, not financial gain, any help I receive along the way is VERY much appreciated. Kindest regards, Kev
  3. I've put a JavaScript Swap Image gallery on my Web site Here, to show pictures of my motorcycle, which I'm selling. My initial testing was successful and it appeared to work fine in all major browsers, however I noticed whilst using a different machine that it is not rendering correctly in all browsers all of the time, differing versions seem to throw it. The gallery is simple enough, one large image of 772px x 579px and 3 rows of 8 thumbnails at 93px x 70px, most browsers render the thumbs as designed with 4px borders, but some browsers or different versions of a browser seem to add to the side border causing the end thumbs to drop a row, Opera even blocks the thumbs into continuous columns. I've spent ages on the problem and tried all sorts, including setting a fixed 'li' border size for the thumbs, but that didn't work either. Ideas/help appreciated!!!!!
  4. KJ

    Email validation

    Thank you monkeysaurus, another URL to add to my educational favourites.
  5. KJ

    Email validation

    Thanks for the response JFab, I'm going to stick with the PHP for now, but I'll certainly look into the Javascript aspect, I'm all for education and self advancement. Though it did take me a week to put together a Javascript picture gallery for a friends motorcycle website.
  6. KJ

    Email validation

    I tried Wickhams code, which would not work within my PHP file, but after some juggling I did get a successful operation together. Looks like this; if (!preg_match("/^([a-z0-9])+([a-z0-9\._%-]+)*@([a-z0-9_-])+([a-z0-9\._-]{2,6})$/i" , ($_POST['email']))) { exit ("<p>Sorry!! That is not a valid email address, please use another.</p>"); } I too was puzzled by the apparent double negative, so I dug out some old university papers, I never wrote a line of PHP at uni but we did cover it a little and I remembered I still had the papers. It appears that in this case, the forward slashes set out the actual search pattern (as usual) and the caret and dollar anchor the search pattern in a 'must match' manner. Effectively, a valid email address must match the entire pattern of the classes In my code, the 1st set of characters must match one of ([a-z0-9]) and if applicable the 2nd set of characters must match one of ([a-z0-9\._%-]+) etc etc. Of course I'm open to correction, if anyone knows or surmises better let us know.
  7. KJ

    Numerical validation

    In response to the question of why I added the || Eext:; to my code in the following string; if (preg_match('/[^][0-9|| Eext:;]/' , ($_POST['phone']))) {} I wanted to ensure that only numbers '0-9' OR '||' the letters ' Eext' could be input to the Telephone input box. The space was to allow breaks between numbers, the uppercase E was incase the user input Ext and I included ':;' incase the user input Ext: or ext; I probably made it too complicated and may take Falconcreative's advise and amend my error message to show a format preference. Or the advise to add another box for the extension, which may well be best. Another potential problem is that the user could repeatedly input the permitted non-numbers, in any order. Thank you!!!
  8. KJ

    Email validation

    Whilst recently amending our sites mail form PHP file, to replace the ‘ereg’ string associated to the ‘Telephone’ input box, with the ‘preg_match’ string, I noticed that our ‘Email’ input box also uses the ‘ereg’ string. Killersites member Wickham pointed out, whilst advising me on my Numerical validation topic, that the ‘ereg’ string was to be obsolete in future PHP versions so I thought I’d best have a go at replacing this string too. I’ve spent a good few hours trying to get a new string to work, sadly I have failed. Here’s the old ‘ereg’ string that has worked successfully for many years; if (!ereg("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a- z]{2,6})$" , strtolower($_POST['email']))) { exit("<p>Sorry!! That is not a valid e-mail address, please use another.</p>"); } Here’s the most successful ‘preg_match’ string I've managed to achieve; if (preg_match(“/^([a-z0-9])+([a-z0-9\._-]+)*@([a-z0-9_-])+([a-z0-9\._-]{2,6})/” , ($_POST['email']))) { exit ("<p>Sorry!! That is not a valid email address, please use another.</p>"); } It will email addresses that do NOT have the @ within them, myselfmysite.com or myself_mysite.co.uk work fine, but myself@mysite.com or my_self@mysite.co.uk do not. I tried single quote as apposed to double, removing the brackets and the parenthesising [^], they all fail with parsing errors. Also, am I correct in excluding uppercase letters within the criteria? Any help much appreciated!!!!!!!
  9. KJ

    Numerical validation

    ********************************* Following my most recent modification of the 'Telephone' code, I received complaints from our staff that they preferred to read phone numbers in the traditional format with breaks. We also received a couple of calls from potential clients that found they could not add extensions to their telephone number when using my mail form. So I modified the code as; if (preg_match('/[^][0-9|| Eext:;]/' , ($_POST['phone']))) { exit ("<p>Sorry!! Invalid telephone format, please use only numbers 0 to 9 inclusive.<br>Prefix extensions with ex or ext.</p>"); } I hope I can now draw a line under this particular problem, though I have noticed another potential problem with my ageing mail form, which I will attempt to rectify over the coming days, or I may post as a new topic should I need help again, as my PHP skills are quite basic. I'd also like to send a personal thank you to Wickham and Falkencreative for their help and advise.
  10. KJ

    Numerical validation

    Thanks Wickham!!! I took on board your comments and modified my code to use the preg_match method as follows; if (preg_match('/[^][0-9]/' , ($_POST['phone']))) { exit ("<p>Sorry!! Invalid telephone format, please use only numbers 0 to 9 inclusive - no spaces.</p>"); } Worked a treat, I had to add the 'no spaces' as the code appears to require continuous numbers with no breaks. Is that how it worked when you tried it?
  11. KJ

    Numerical validation

    Thanks for the advise Wickham. I modified the suggested code to suit my structure, which works fine when only letters are input into the 'Telephone' input box, resulting in an error message. However if numbers and letters are input the mail form is passed. My code is as follows; if (!ereg("^[0-9]" , $_POST['phone'])) { exit("<p>Sorry!! Invalid telephone format, please use only numbers 0 to 9 inclusive.</p>"); }
  12. KJ

    Numerical validation

    I have a mail form up and running, but I cannot get my telephone input box to only allow numbers. It's probably an easy fix, so if anyone has ideas on how to set the input to numerical only I'd very much appreciate the help. Thanx!!!!
  13. I?m doing a project for a mate who is aiming to sell motorcycle accessories online using only PayPal payments. At + half a century I?m not a young techie whiz like many of you and I?m not in the Web development profession, I?m working simply as a favour and to further enhance my skills (and free bike maintenance). I?m not new to PHP, as I have previously designed a PHP mailform, but I have a feeling this?ll be a bigger deal than that. I?ve briefly viewed several of the PayPal shopping cart videos, just to give me an idea of what to expect, this has thrown up a few questions which I hope you?ll find the time to help me with: ? I develop all my Web pages using Notepad and use QuickPHP to run scripts. ? Will I NEED to make use of the free Eclipse software? ? A database will not be required for the site, yes, I have extolled the virtues of DBs but he insists a database will not be needed. ? Do I have to use MySQL? ? I have already developed the main site ? info pages, contact, bike list and associated detail pages (bikes will not be for sale online) and I?ve also developed the ?shop? pages ? tyres, helmets, exhausts etc, I?ve even sorted the format of the ?product_box? Div for each individual item. ? Will I be able to integrate what I learn into such a box? On an existing site? ? Some items will simply need an ?Add to Cart? button, others such as tyres will need a size option box, helmets will require size and colour options. ? What?s the best way to solve that problem? ? Postage will be determined by total order e.g. <?10 = ?3.00, >?10 <?30 = ?7, >?30 = free. ? Will this be an achievable object? ? There will be quite a few ?shop? pages so I would like to embed within these pages a minicart to display to the user how many items are in the cart and the total currently spent. ? Is this likely to be possible? I anticipate this taking me a few weeks to complete, though I would like to get the site completed, tested and operational within time for the new bike season, usually April.
×
×
  • Create New...