# Return result of mysql query to field of calling html form

**URL:** <https://forum.kirupa.com/t/return-result-of-mysql-query-to-field-of-calling-html-form/324237>\
**Category:** Uncategorized\
**Created:** [August 9, 2011, 8:41pm UTC](https://forum.kirupa.com/t/return-result-of-mysql-query-to-field-of-calling-html-form/324237 "2011-08-09T20:41:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ray\_Ward](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@Ray\_Ward](https://forum.kirupa.com/u/Ray_Ward)\
**Post date:** [August 9, 2011, 8:41pm UTC](https://forum.kirupa.com/t/return-result-of-mysql-query-to-field-of-calling-html-form/324237/1 "2011-08-09T20:41:39Z")

</div>

My html ‘form1’ receives a customer ‘did’ number, and other data from the incoming url.On submit it goes to the following ‘test’ php script. I am trying to populate the ‘name’ field in ‘form1’ with the results of this query

?php // Receiving variables from first form ‘form1’ 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(“host”, “db”, “pw”) or die(mysql\_error());  
mysql\_select\_db(“bus1”) or die(mysql\_error());  
// Get a specific result from the “mainleticias”  
$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  
$name=$row[‘name’];  
echo $name;  
// I get the right name/=email here, but I need it to populate name field in first form ‘form1’

I have been trying for over 2 weeks to get help with this problem to no avail.I have googled my hands off.Is it possible or am I wasting my time?It seems like it should be an easy thing to do, at least I thought so…  
looking forward to anyones reply.  
Thank you  
Ray Ward
