Jump to content


Photo

comparing form to database


  • Please log in to reply
3 replies to this topic

#1 adult.swim

adult.swim
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 10 July 2006 - 01:17 AM

Im trying to:

1. create a form page in HTML

2. create a .php page that queries an ODBC database that I have, and compares info submitted

in the form to info in my database.

My question is how can i make the comparison between my form and my databse.

form.html---


<form action="process.php" method="get">
mlsnumber:
  <input name="mlsnumber" type="text" />
<input name="" type="submit" />
</form>

process.php--- "this is what i have so far...

# connect to a DSN "homep_props" with a user and password ""
$connect = odbc_connect("homep_props", "", "");

# query the users table for *
$query = "SELECT * FROM props";

# perform the query
$result = odbc_exec($connect, $query);

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 10 July 2006 - 01:41 AM

For what it's worth, you can retrieve the value of the variable mlsnumber when the form is submitted to your php script with this:
<?php
$mlsnumber = trim(strip_tags($_GET['mlsnumber'])); // retrieve and remove whitespace, etc.

To help, we'll need a better understanding of what you want to compare ...
Legend has it that reading the manual never killed anyone.
My site

#3 adult.swim

adult.swim
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 10 July 2006 - 02:46 AM

ok I made a MS Access database, that has 2 records in it.

The 1st field of the records is the ID number, the next field is the mlsnumber.

I want to be able to compare the input from the form (form mlsnumber) to the field in my database. e.g. if they match output TRUE, if not output FALSE.





#4 adult.swim

adult.swim
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 10 July 2006 - 03:25 AM

Would I be able to use:

$fmlsnumber = $_GET['mlsnumber']; (form input mlsnumber)

------and-------

# fetch the data from the database
while(odbc_fetch_row($result)){
$mlsnumber = odbc_result($result, 2); (database mlsnumber; the location of it in the database)

# print("$mlsnumber \n");
}

to somehow compare the two?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users