Jump to content

[SOLVED] if statement help


yukafluck

Recommended Posts

I have a small form on one of my pages that then calls the page again with a variable.

 

I have the link set up that when it goes to the page it starts off with:

vehicles_list.php?yearnarrow=_%

[code=php:0]

this way it starts showing all of the vehicles listed, but when it runs, I have it show the year that has been selected, but when it starts it shows the %.

 

How can I do it so that it shows as "All" instead of the %?

 

here is the code that I am working with:

 

[code=php:0]

<form name="Year" id="Year">

<select name="YearMenu" onchange="MM_jumpMenu('parent',this,0)">

<option selected="selected"><?php echo $yearnarrow?></option>

   

        <?php

  include_once "_functions/db_info.php";

  //connect to database

$dbserver = mysql_connect($hostname, $dbuser, $dbpswd);

$connection = $dbserver or die ('I cannot connect to the server');

mysql_select_db ($dbname) or die ('I cannot connect to the database');

  $sqlGetVehicleYear="SELECT COUNT(*) num, vehicle_year  FROM vehicles GROUP BY vehicle_year DESC; ";

  $sqlGetVehicleYearRes = mysql_query($sqlGetVehicleYear,$connection) or die ("could not connect to  sqlGetVehicleYear ");

While ($row = mysql_fetch_array($sqlGetVehicleYearRes))

{

$vehicle_year=$row["vehicle_year"]; 

  ?>

             

            <option value="vehicles_list.php?makenarrow=%&typenarrow=%&yearnarrow=<?php echo $vehicle_year ?>"><?php echo $vehicle_year ?>  (<?php echo $row['num']; ?>)</option>

 

      <?php }?>

  </select>

    </form>

Link to comment
https://forums.phpfreaks.com/topic/160834-solved-if-statement-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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