Jump to content

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);
Link to comment
https://forums.phpfreaks.com/topic/14133-comparing-form-to-database/
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 ...
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.



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?
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.