adult.swim Posted July 10, 2006 Share Posted July 10, 2006 Im trying to:1. create a form page in HTML2. 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); Quote Link to comment https://forums.phpfreaks.com/topic/14133-comparing-form-to-database/ Share on other sites More sharing options...
AndyB Posted July 10, 2006 Share Posted July 10, 2006 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 ... Quote Link to comment https://forums.phpfreaks.com/topic/14133-comparing-form-to-database/#findComment-55354 Share on other sites More sharing options...
adult.swim Posted July 10, 2006 Author Share Posted July 10, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/14133-comparing-form-to-database/#findComment-55380 Share on other sites More sharing options...
adult.swim Posted July 10, 2006 Author Share Posted July 10, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/14133-comparing-form-to-database/#findComment-55388 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.