Jump to content

gigabyt3r

Members
  • Posts

    41
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

gigabyt3r's Achievements

Member

Member (2/5)

0

Reputation

  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
×
×
  • 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.