Jump to content

dani33l_87

Members
  • Posts

    38
  • Joined

  • Last visited

dani33l_87's Achievements

Member

Member (2/5)

0

Reputation

  1. Ok, You are right, is the most secure and easy why to do it. Thanks
  2. yes, but this was my first thought and for the moment I think is the best. Other option is to use a form for the user to chose the state and the city, is also a option.
  3. I have build a small form that take the zip code that user enter and if is on my list will redirect to a sub domain craigslist. I was checking all the zip codes and is pretty hard to know to what bigger city to attribute the given zip code and for that I was thinking to a simple idea to use, I am not sure how much exact will be but I think will do the trick for the moment. The zip code range start from 00501 to 99950. I create a array with the biggest city shown in craigslist and the zip code that correspond. Now the tricky part, what I will do with the rest of the zip codes and my idea is to measure the distance from one to another zip code and which zip code from the array is closer from given one to take it. <?php $zip = $_GET['zip']; $z = array ( 36830 => array ( 'auburn.craigslist.org' ), 35242 => array ( 'bham.craigslist.org' ), 36301 => array ( 'dothan.craigslist.org' ), 35630 => array ( 'shoals.craigslist.org' ), 35901 => array ( 'gadsden.craigslist.org' ) ?> Exemple: $zip= 36870 // the code received from the user 36870 - $array= ( 'auburn.craigslist.org' ), (36830 = 40) (36301 = 569) (36911 = -41) // the minus will be excluded (....etc) After checking the zip code with the ones from array, the smaller score will attribute the sub-domain correspond from the array. I hope will don t be the case when will get the same result from two zip codes:) Now I am using this rule: $zip0 = (isset($z[$zip][0]) && $z[$zip][0] != '') ? $z[$zip][0] : 'craigslist.org/about/sites#US'; and I was thinking to redirect the user for a page to enter the state and the city. But I wish to make it more precises and not to involved the user so much. But if there are any other suggestions I will be glad to hear them.
  4. I have this form: Start Year: <select name="start"><option value="" selected="selected"></option> <option value="1991">1991</option><option value="1992">1992</option><option value="1993">1993</option><option value="1994">1994</option></selected. to: <select name="end"><option value="" selected="selected"></option> <option value="2015">2015</option><option value="2014">2014</option><option value="2013">2013</option><option value="2012">2012</option> <option value="2001">2001</option><option value="2010">2010</option></select> $start = $_GET['start']; // value="1994" $end = $_GET['end']; // value="2001" //the value can change How can I get all the years between 1994-2010 + some text $years= T1994YearT1995YearT1996YearT1997YearT1998YearT1999YearT2000YearT2001Year
  5. Yes Ch0cu3 you are right. Now is working how I want. Thanks guys for the help.
  6. The structure for the array look nice, but what about the connection between the form and the array. Because now is not taking into the consideration the value that come through input: $miles=$_GET['miles']; $miles = array ( 25 => array ('close', 'closest', 'hot'), 50 => array ('aaa', 'bbb', 'ccc'), 100 => array ('xxx', 'yyy', 'zzz') ); In this case we have all the three values but only one need to be shown. For example: echo $miles[2] will show ccc // when 50 is the form outcome if the outcome is 100 then echo $miles[2] will show zzz if will be 25 echo $miles[2] will show hot. I would like to keep &miles[array number] because I don`t know the output and will make easier to be used in a code. This is pretty much the result wanted.
  7. I have this form: <form method="get"> Distance: <select name="miles"> <option value="25" selected="selected">25 Miles</option> <option value="50">50 Miles</option> <option value="100">100 Miles</option> </select> <p><input type="submit" value="Submit"> </form> and the php script file: <?php $miles=$_GET['miles']; // this is how I get the value of the input miles and try to convert the value (25) into a array $25=array("close", "closest", "hot") // the value 25 will have three shown variants echo "This is, $25[2]"; // result This is hot. - this is the result that I want echo "This is, $25[1]"; // closest echo "This is, $25[0]"; // close ?> I have problems to split a value into array, because for each value (25, 50, 100...) will be shown different echo words like in the example. I look on the internet but I can t really find something to help me with this. It is a solution in PHP that will don t need to change the html form?
  8. I succeed to find the last piece of the puzzle. Thanks all for your help and patience.
  9. Yes maxxd the last part is what I want: $link = "http://ebay.com/{$_GET['type']}/{$_GET['year']}/{$_GET['color']}/"; But the first part is the problem. Because in the form should be only 2 option, that will have more values in the php script. The solution will be this: <?php $linkArray = array( 'new' => array( newcars/', new/', newmake/' ), 'old' => array( 'oldcars/', /old/', 'oldmake/' ) ); ?> But how can I take each array and put it in the link, because in "new" they are 3 array, how can I take a specific one and add to the link $link = "http://ebay.com/{$_GET['new']}/{$_GET['year']}/{$_GET['color']}/"
  10. I was thinking to an easier approach because they are more filters, something like: http//ebay.com/{$_GET[NEW]}/$_GET[YEAR]....etc If I use the array approach I will need to create a new php file for each filter
  11. No database, because is not so much data, but yes is also a good option what you say. I try to make this simple as possible.
  12. Can you show me a short example, because I don t really understand how this should be done.
  13. I don t want to do this in a form, for that I will use a script file, but how I suppose to split it? when I will get the filter
  14. Is not the answer what I am looking for. Jacques1, the text field is only for example, I will use radio buttons. To be more explicit, when you buy a car you have more filters: NEW & USED (for this we create radio buttons for the user to chose) There are many website (3 for example) that have a primary link: http//ebay.com http//cars.com http//auto.com For New cars the value information needed to each website it s different, for example http//ebay.com/newcars/ http//cars.com/new/ http//auto.com/newmake/ The user Select NEW (radio Buttons) and a php engine will add the above information for each link, having a predetermined information: NEW = new[0] = "newcars/" NEW = new[1] = "new/" NEW = new[2] = "newmake/" The result script for will be: href="http://ebay.com/$_GET(new[0]) ==== > http//ebay.com/newcars/ This I will want to do for every link, if is possible. I hope now everything is more clear.
×
×
  • 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.