I'm using Microsoft tags to get the cell phones unique "did' number loaded into a htm form field. The customer is then asked to enter thier email address on the form. The form is then submitted to be added to our customer mysql database. If it's new it is added if he's returning it's updated with new date info, add number of visits, ect.
The form works fine.
What I'm trying to do is reduce the customers from always having to type in thier email address everytime if they are already in the database.
I wrote a php mysql query that checks if they are in the database that works good, it finds the correct email field but I can't fiqure out how to get this variable back to my htm email form field.

I have spent many hours on the net and I'm really lost. It seems like it shoild be a very simple thing to do.
Looking forward to anyones suggestions.
Thank you
Ray Ward

Recommended Answers

All 2 Replies


you simply check the data from your SQL-result and place it in the HTML-Form. Eg:

<input type="text" value="<?echo $row[0]?>">

as row is the fetched row of the query. When using fetch-array it's kind of

<input type="text" value="<?echo $arr['email']?>">

or whatever, but I'm not really used to that (I'm very very old school, I know).

Hope that helps. Feel free to ask more, if you still struggle.

sDJh - Thank you for your reply! I probally didn't explain my problem in enough detail. Data comes into my 'form1' from the url. That data is sent to a php program (test.php) that querys mysql database pulling out the customers email address using thier unique phone 'did' number.
If found the email address is displayed back in 'form1' and if correct (or can be corrected) and can be submitted for update or insert by my program 'index.php' (index.php handles the decision to update or insert and works great) If not found the email field is left blank and you are sent back to 'form1' to enter email address and submit. I have listed the code fot the 'test.php' file below..
Thank you

     // Receiving variables from first form and is working good
     @$name = addslashes($_GET['name']);  // this is now being used for email data
     @$email = addslashes($_GET['email']); // not used see name
     @$phone = addslashes($_GET['phone']); // not used
     @$id = addslashes($_GET['id']);
     @$visits = addslashes($_GET['visits']);
     @$cust_lat = addslashes($_GET['cust_lat']);
     @$cust_long = addslashes($_GET['cust_long']);
     @$cust_did = addslashes($_GET['cust_did']); //this is unique phone id that comes in
     @$event = addslashes($_GET['event']);
     @$date_created = addslashes($_GET['date_created']);
     @$date_updated = addslashes($_GET['date_updated']);
     // Make a MySQL Connection
     mysql_connect("xxxxxxxxx.ipowermysql.com", "xxxxx", "xxxxx") or die(mysql_error());
     mysql_select_db("bus1") or die(mysql_error());

     // Get a specific result from the "mainleticias" table
     $result = mysql_query("SELECT * FROM mainleticias WHERE did='$cust_did'") or die(mysql_error());  

     // get the first (and hopefully only) entry from the result
     $row = mysql_fetch_array($result);
     // Print out the contents of each row into a table 
     echo $name;   // I get the right name/=email here, but I need it to populate name field in first 'form1'

I hope this helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.