Jump to content

gigabyt3r

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Everything posted by gigabyt3r

  1. How can I grab information from a webpage? For example if I wanted to get the time a search took on google where it says "Results 1 - 10 of about 610,000,000 for php. (0.05 seconds)" How could i get the '0.05' bit from the source to use it as a string? Thanks in advance
  2. I have 11 tickboxs on my form and when I tick 1 or more of them and submit the form, it still returns every make listed below, why is this? //display all models vehicles when submit button isnt pressed if (!isset($_POST['Ford']) && (!$_POST['Mercedes']) && (!$_POST['Vauxhaull']) && (!$_POST['Citroen']) && (!$_POST['Peugeot']) && (!$_POST['Iveco']) && (!$_POST['FIAT']) && (!$_POST['Nissan']) && (!$_POST['Renault']) && (!$_POST['Volkswagen']) && (!$_POST['OtherMakes'])); { $Make = "Ford', 'Mercedes', 'Vauxhaull', 'Citroen', 'Peugeot', 'Iveco', 'FIAT', 'Nissan', 'Renault', 'Volkswagen', 'DAF', 'Isuzu', 'MAN', 'Moffet', 'Scania', 'Toyota', 'LDV', 'Land Rover', 'Daihatsu' 'Mitsubishi"; } Tried to work it out for hours and can't figure out why it won't work? Thanks in advance
  3. I tried that bit of code and it worked when i just selected the N/A Roof Height but when i selected standard or medium etc then it returned all the roof heights same as before! Any ideas why it wont work? Thanks
  4. I am trying to get this query to show the appropriate ticked vehicle roof height, unless no boxs are ticked then I want it to display all vehicle roof heights. However it doesn't work correctly, for example if i tick the Standard roof Height checkbox then submit the form and echo the $RoofHeight to the page I get: N/A', 'Standard Roof', 'Medium Roof', 'High Roof The same goes if I check the medium or high roof buttons. If I tick the N/A button then it just returns "N/A", so why does it work for 1 tickbox but not the others? Here is my PHP code; //display all roof height vehicles when submit button isnt pressed if (!isset($_POST['N/ARoofHeight']) && (!$_POST['Standard Roof']) && (!$_POST['Medium Roof']) && (!$_POST['High Roof'])) { $RoofHeight = "N/A', 'Standard Roof', 'Medium Roof', 'High Roof"; } //N/A Roof Height Only if (isset($_POST['Submit']) && isset($_POST['N/ARoofHeight'])) { $RoofHeight = $RoofHeight."N/A"; } //Standard Roof Only if (isset($_POST['Submit']) && isset($_POST['Standard Roof'])) { $RoofHeight = $RoofHeight."Standard Roof"; } //Medium Roof Only if (isset($_POST['Submit']) && isset($_POST['Medium Roof'])) { // add comma if necessary to separate if (!empty($RoofHeight)) { $RoofHeight = $RoofHeight."', '"; } $RoofHeight = $RoofHeight."Medium Roof"; } //High Roof ONLY if (isset($_POST['Submit']) && isset($_POST['HighRoof'])) { // add comma if necessary to separate if (!empty($RoofHeight)) { $RoofHeight = $RoofHeight."', '"; } $RoofHeight = $RoofHeight."HighRoof"; } Can anyone see whats wrong with it? Thanks in advance
  5. Sure. //display all models vehicles when submit button isnt pressed if (isset($_POST['Submit']) && (!isset($_POST['Ford']) || (!$_POST['Mercedes']) || (!$_POST['Vauxhaull']) || (!$_POST['Citroen']) || (!$_POST['Peugeot']) || (!$_POST['Iveco']) || (!$_POST['FIAT']) || (!$_POST['Nissan']) || (!$_POST['Renault']) || (!$_POST['Volkswagen']) || (!$_POST['OtherMakes'])); { $Make = "Ford', 'Mercedes', 'Vauxhaull', 'Citroen', 'Peugeot', 'Iveco', 'FIAT', 'Nissan', 'Renault', 'Volkswagen', 'DAF', 'Isuzu', 'MAN', 'Moffet', 'Scania', 'Toyota', 'LDV', 'Land Rover', 'Daihatsu' 'Mitsubishi"; } //Ford Only if (isset($_POST['Submit']) && isset($_POST['Ford'])) { $Make = $Make."Ford"; } Thanks
  6. $Make = "Ford', 'Mercedes', 'Vauxhaull', 'Citroen', 'Peugeot', 'Iveco', 'FIAT', 'Nissan', 'Renault', 'Volkswagen', 'DAF', 'Isuzu', 'MAN', 'Moffet', 'Scania', 'Toyota', 'LDV', 'Land Rover', 'Daihatsu' 'Mitsubishi"; I get a Parse error in line 46, this is line 46 and 47 but i can't see the problem?
  7. I inserted the bit of code below in replace of mine and it works great, apart from when you first load the page no vehicles are shown and I would like all vehicles to be displayed, not sure which part I need to change // the form is submitted if(strlen($_POST['submit']) && $_POST['submit'] == 'submit') { if(is_array($_POST['make'])) { // options are selected $makes = array(); foreach($_POST['make'] as $make) { $makes[] = "'".$make."'"; } $result = mysql_query("SELECT * FROM models WHERE manufacturer IN (".implode(",",$makes).")"); } }
  8. I don't understand how to implement what you said Im confused
  9. Thats the name of a button
  10. Hi, I have several checkboxs on my form, which when no checkboxs are ticked then it displays all the vehicle models, or you can select individual models but it doesn't seem to work the way I want it to. Here is my PHP code; //SELECT ALL MAKES IF NON ARE SELECTED if (!isset($_POST['Ford']) || (!$_POST['Mercedes']) || (!$_POST['Vauxhaull']) || (!$_POST['Citroen']) || (!$_POST['Peugeot']) || (!$_POST['Iveco']) || (!$_POST['FIAT']) || (!$_POST['Nissan']) || (!$_POST['Renault']) || (!$_POST['Volkswagen']) || (!$_POST['DAF, Isuzu, MAN, Moffet, Scania, Toyota, LDV, Land Rover, Daihatsu, Mitsubishi'])) { $Make = "Ford', 'Mercedes', 'Vauxhaull', 'Citroen', 'Peugeot', 'Iveco', 'FIAT', 'Nissan', 'Renault', 'Volkswagen', 'DAF', 'Isuzu', 'MAN', 'Moffet', 'Scania', 'Toyota', 'LDV', 'Land Rover', 'Daihatsu', 'Mitsubishi"; } //Ford Only if (isset($_POST['Submit']) && isset($_POST['Ford'])) { $Make = $Wheelbase."Ford"; } //Mercedes ONLY if (isset($_POST['Submit']) && isset($_POST['Mercedes'])) { // add comma if necessary to separate if (!empty($Make)) { $Make = $Make."', '"; } $Make = "Mercedes"; } //Vauxhaull ONLY if (isset($_POST['Submit']) && isset($_POST['Vauxhaull'])) { // add comma if necessary to separate if (!empty($Make)) { $Make = $Make."', '"; } $Make = $Make."Vauxhaull"; } //Citroen ONLY if (isset($_POST['Submit']) && isset($_POST['Citroen'])) { // add comma if necessary to separate if (!empty($Make)) { $Make = $Make."', '"; } $Make = $Make."Citroen"; } //Peugeot ONLY if (isset($_POST['Submit']) && isset($_POST['Peugeot'])) { // add comma if necessary to separate if (!empty($Make)) { $Make = $Make."', '"; } $Make = $Make."Peugeot"; } //Iveco ONLY if (isset($_POST['Submit']) && isset($_POST['Iveco'])) { // add comma if necessary to separate if (!empty($Make)) { $Make = $Make."', '"; } $Make = $Make."Iveco"; } //FIAT ONLY if (isset($_POST['Submit']) && isset($_POST['FIAT'])) { // add comma if necessary to separate if (!empty($Make)) { $Make = $Make."', '"; } $Make = $Make."FIAT"; } //Nissan ONLY if (isset($_POST['Submit']) && isset($_POST['Nissan'])) { // add comma if necessary to separate if (!empty($Make)) { $Make = $Make."', '"; } $Make = $Make."Nissan"; } //Renault ONLY if (isset($_POST['Submit']) && isset($_POST['Renault'])) { // add comma if necessary to separate if (!empty($Make)) { $Make = $Make."', '"; } $Make = $Make."Renault"; } //Volkswagen ONLY if (isset($_POST['Submit']) && isset($_POST['Volkswagen'])) { // add comma if necessary to separate if (!empty($Make)) { $Make = $Make."', '"; } $Make = $Make."Volkswagen"; } //Other makes ONLY if (isset($_POST['Submit']) && isset($_POST['DAF, Isuzu, MAN, Moffet, Scania, Toyota, LDV, Land Rover, Daihatsu, Mitsubishi'])) { // add comma if necessary to separate if (!empty($Make)) { $Make = $Make."', '"; } $Make = $Make."DAF', 'Isuzu', 'MAN', 'Moffet', 'Scania', 'Toyota', 'LDV', 'Land Rover', 'Daihatsu', 'Mitsubishi"; } And here is the actual query being submit (I only selected the Mercedes tickbox). SELECT * FROM vehicles WHERE Make IN ('Ford', 'Mercedes', 'Vauxhaull', 'Citroen', 'Peugeot', 'Iveco', 'FIAT', 'Nissan', 'Renault', 'Volkswagen', 'DAF', 'Isuzu', 'MAN', 'Moffet', 'Scania', 'Toyota', 'LDV', 'Land Rover', 'Daihatsu', 'Mitsubishi', 'Mercedes') Which seems its searching for all the makes, then adding Mercedes on to the end again. However when i tick the "Ford" box then the query works and it only returns Fords, even though the querys are the same! Does anyone know whats wrong with my query? Thanks in advance
  11. Lol Another little problem I have is I only want specific colour vehicles to come up if a value is entered in the colour box, but if it is left blank I'd like it to return all colour vehicles. Any idea what would be the best way to do it? Bump anyone
  12. Thanks for the reply although im not sure how to implement is :S This is my query so far its quite big $query_rsVehicle = "SELECT ID, `Vehicle Registration`, Make, Model, Color, Transmission, `Fuel Type`, Mileage, `Reg Year`, `Image Prefix`, `Key Point 1`, `Key Point 2`, `Key Point 3`, `Key Point 4` FROM vehicles WHERE Model LIKE \"%$Search%\" AND Wheelbase IN ('$Wheelbase') AND `Roof Height` IN ('$RoofHeight') AND Color LIKE ('$Colour')";
  13. Hi, I was wondering how I can select all the different colours in a database if no specific colour is entered? Here is my code; //Colour Search Box if($_POST['Colour'] != "") { $Colour = $_POST['Colour']; } else { $Colour = "ALL COLOURS"; } Thanks in advance
  14. Lol Another little problem I have is I only want specific colour vehicles to come up if a value is entered in the colour box, but if it is left blank I'd like it to return all colour vehicles. Any idea what would be the best way to do it?
  15. <form name="form1" method="post" action=""> <label></label> <p><strong><u>Make</u></strong></p> <p> <input type="checkbox" name="input" value="" /> Ford</p> <p> <input type="checkbox" name="input2" value="" /> Mercedes</p> <p> <input type="checkbox" name="input3" value="" /> Vauxhaull</p> <p> <input type="checkbox" name="input4" value="" /> Citroen</p> <p> <input type="checkbox" name="input5" value="" /> Peueot</p> <p> <input type="checkbox" name="input6" value="" /> Iveco</p> <p> <input type="checkbox" name="input7" value="" /> Fiat</p> <p> <input type="checkbox" name="input8" value="" /> Nissan</p> <p> <input type="checkbox" name="input9" value="" /> Renault</p> <p> <input type="checkbox" name="input10" value="" /> Volkswagen</p> <p> <input type="checkbox" name="input11" value="" /> Other Makes (DAF, Isuzu, MAN, Moffet, Scania, Toyota, LDV, Land Rover, Daihatsu, Mitsubishi)</p> <p> </p> <p><strong><u>Wheelbase</u></strong></p> <p> <input type="checkbox" name="AWB" value="AWB" /> All Wheelbases</p> <p> <input type="checkbox" name="SWB" value="SWB" /> Only Show Short Wheelbase Vehicles </p> <p> <input type="checkbox" name="MWB" value="MWB" /> Only Show Medium Wheelbase Vehicles </p> <p> <input type="checkbox" name="LWB" value="LWB" /> Only Show Long Wheelbase Vehicles</p> <p> </p> <p><strong><u>Roof Height</u></strong></p> <p> <input type="checkbox" name="AllRoof" value="AllRoof" /> All Roof Heights </p> <p> <input type="checkbox" name="N/A" value="N/A" /> N/A Roof Height Vehicles </p> <p> <input type="checkbox" name="StandardRoof" value="Standard Roof" /> Standard Roof </p> <p> <input type="checkbox" name="MediumRoof" value="Medium Roof" /> Medium Roof</p> <p> <input type="checkbox" name="HighRoof" value="High Roof" /> High Roof </p> <p> </p> <p><u>Colour</u></p> <p> <label> <input type="text" name="colour" id="colour" /> </label> </p> <p> </p> <p><u>Price</u></p> <p>From <label> <input type="text" name="textfield2" id="textfield2" /> </label> - <label> <input type="text" name="textfield3" id="textfield3" /> </label> </p> <p> </p> <p>Custom Search: <input type="text" name="textfield4" id="textfield4" /> </p> <p> </p> <p> <input type="submit" name="Submit" id="button" value="Submit" /> </p> <p><br /> Order results by: <select name="orderBy" id="orderBy"> <option value="`Reg Year`">Reg Year</option> <option value="`Mileage`">Mileage</option> <option value="`Wheelbase`">Wheelbase</option> <option value="`Model`">Model</option> </select></p> </form>
  16. Realized is should be != ""; However still says Colour Box empty when its not!
  17. Title says it all, can't seem to figure out why it won't work? //Colour Search Box if(strlen($_POST['Colour']) != 0) { echo "Colour has a value"; } else { echo "Colour box is empty!"; }
  18. I think its because of if (!isset($_POST['Submit'])) { $Wheelbase = "SWB', 'MWB', 'LWB"; } And of course if you select a roof height then the Submit button is posted although there is no Wheelbase value! It sounds a little confusing but if you dont understand just say and I will try explain better. Thanks in advance
  19. After much tweaking and frustration i found that when I select a roof height it doesn't work $query_rsVehicle = "SELECT ID, `Vehicle Registration`, Make, Model, Color, Transmission, `Fuel Type`, Mileage, `Reg Year`, `Image Prefix`, `Key Point 1`, `Key Point 2`, `Key Point 3`, `Key Point 4` FROM vehicles WHERE Model LIKE \"%$Search%\" AND Wheelbase IN ('$Wheelbase') AND `Roof Height` IN ('$RoofHeight')"; but when i take the AND Wheelbase IN ('$Wheelbase') it works! The problem is I need them both to work! Anyone have any idea what the best way around this is?
×
×
  • 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.