mylesrobinson
-
Posts
6 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by mylesrobinson
-
-
Ok thanks. Sorry for the confusion. I am oblivious to where to put the code suggested though. I am very inexperienced with writing code but i know how to upload it and understand the code that i see (mostly!) but unable to figure out where i need to put the substr(), strtolower() and strpos in the code that i put in my original post. I will keep trying to work it out.
-
HiThanks for that, it works. However a lot of the time they will enter a postcode such as fk1 4eh so I would need it to only pick up on the first 3 and sometimes 4 characters. Another point is that they are not actually case sensitive so would the 'case' bit be applicable? Thanks for your help
-
Hi
Thanks for your reply. I will show you what bits of the postcodes i need for each of the 2 URL redirects:
<?php$agree = $_GET['agree'];switch ($agree){case ("ky1", "ky2", "ky3", "ky12", "ky13", "ky14":)header("Location: http://www.concretegaragesscotland.com");break;case ("fk1", "fk12", "fk13":)header("Location: http://www.patersons...buildings.co.uk");break;}?>So as you see, i have a range of data that someones postcode may start with. If it does start with any of those in the code above then they will route to that specified URL. -
Hi
Thanks for your reply.
I think the $agree bit is wrong.
I am basically wanting redirects to one of 2 websites based upon data from the first 3 and 4 characters of the postcode when entered into the form i have set up in gravity forms. It doesn't need to be case sensitive (which i think it is in the above code).
I am not very experienced in PHP but i am sure that the code doesn't need altering too much from what i have already?
-
Hi
I am trying to get some code working correctly so that i can route users to a URL redirect when completing a form on our website. There are only 2 URL's to redirect to but there are a range of post codes that i need to add to the code.
At the minute the code works only if the letters are the same case (Caps or not caps) and when i enter more than one postcode, the form comes back with a PHP error.
I basically need to be able to let the user enter a postcode and the code will work for the first 3 AND 4 (sometimes) characters. For example a post code may be EH2 or EH34 and i would need the form to be able to do this.
Sorry for the lack of knowledge on this but i hope someone can help. The code is posted below what i currently have.
<?php$agree = $_GET['agree'];switch ($agree){case "ky1":header("Location: http://www.concretegaragesscotland.com");break;case "FK", :header("Location: http://www.patersonsgardenbuildings.co.uk");break;}?>
Routing PHP Code - Help!
in PHP
Posted
I have had my PHP working for a while now, but it has come to the point where i need it altering.
Basically, at the minute, the code works only when a user inputs a space in their postcode (eg: WF8 5TD) and will not work if it was entered like this: (eg: WF85TD)
I want the code to work so that it picks up on the first 2, 3 or 4 characters without the space in the postcode being an issue- or any other way so that if the user does not enter a space in their postcode, the form will still route to what page i want it to. The code i have is below:
It should be mentioned that i have email routing also which works as i want the above to. A snippet of the email routing code is below: