Jump to content

problems with search form numerical "between" sending by php


4x4ing

Recommended Posts

I am trying to display the results of a search, on a sql database, on a web page. I set up html "select form" and set value to "Between x and x" I get a resource error when submitting the form. I works ok when using "LIKE" or "<" but I cannot get a between to work.

The purpose for this is to allow a custormer to search a vehicle inventory by prices between set points.

The HTML page the form is <a href="http://www.docwilsonsauto.com/index.html">here</a> there is no php on this page so just view the source.

 

Here is the code from the .PHP

And thank you for reading this I am stumped on why this will not work. The other searches I made work great.

 

 

<?php

$con = mysql_connect("***********.***.*****","********","******");

if (!$con)

  {

  die('Could not connect: ' . mysql_error());

  }

 

mysql_select_db("docwilson", $con);

 

$result = mysql_query("SELECT *

FROM  `Inventory`

WHERE  `Selling Price`('$_POST[search1]')");

 

while($row = mysql_fetch_array($result))

  {

  echo $row ['Stock Number'] . " " . $row['Make']." " . $row['Model']." " . $row['Color']." ". $row['Miles']." ". $row['Selling Price'];

  echo "<br />";

  }

 

mysql_close($con)

?>

 

 

Link to comment
Share on other sites

Well I have the BETWEEN operator in the html for like this

 

 

Is there anything wrong with that?

I tried it the other way also. Like you said with the between operator on the php page and it did not work either. How does Method= "post" handle spaces? could it be introducing an error?

Thanks

 

 

[pre]<form action="jeep-search-by-price.php" method="post">

 

  Search By Price Range:

  <select name="search1">

    <option VALUE= "BETWEEN 0 AND 5000">Less Than $5000</option>

    <option value="BETWEEN 4500 and 10500">$5000-$10,000</option>

    <option value="BETWEEN 10000 and 99000">More Than $10,000</Option>

   

  </select>   

    <input type="submit" value="Submit">[/pre]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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