Jump to content

Archived

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

adult.swim

comparing form to database

Recommended Posts

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);

Share this post


Link to post
Share on other sites
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:
[code]<?php
$mlsnumber = trim(strip_tags($_GET['mlsnumber'])); // retrieve and remove whitespace, etc.[/code]

To help, we'll need a better understanding of what you want to compare ...

Share this post


Link to post
Share on other sites
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.



Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

×

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.