sending code from php to text field
Posted: Fri Mar 28, 2008 3:22 pm
I am trying to run an sql statement to retrieve F_name and L_name from the sql filed where uniqid = 'buttons'
I am not sure how to take the individual fields aka F_name and L_name and send the information back to my form to the specific text fields they need to be attached to.
here is what I have been trying
First i create a dynamic button that will run this sql
it will generate the following
NOTE: (button("select") refers to a button that is created with a dynamic name and a value = 'select'
(Button("select") firstname lastname
now when i click (button("select") it will call the php again and do the following
any help would be much apprediated
Also the code for my fisrt and last name fields are as follows
I am not sure how to take the individual fields aka F_name and L_name and send the information back to my form to the specific text fields they need to be attached to.
here is what I have been trying
First i create a dynamic button that will run this sql
it will generate the following
NOTE: (button("select") refers to a button that is created with a dynamic name and a value = 'select'
(Button("select") firstname lastname
Code: Select all
foreach ($line as $col_value) {
if ($count == 0){
echo "<input type = 'submit' name = 'buttons[$curr_id]' value = 'Select' />";
$count ++;
}else{
$nameval = ($col_value . " ");
echo "$nameval";
//echo "$col_value ";
}
}
$count = 0;
echo "<p>";
Code: Select all
} else if (isset($_POST['buttons'])) {
$query = mysql_query(
"SELECT `F_Name`,
`L_Name`
FROM `people`
Where uniqid = 'buttons'"
) or die (mysql_error());
//process
$col = mysql_fetch_array($query, MYSQL_ASSOC);
}
//I dont know what to put here
}
Also the code for my fisrt and last name fields are as follows
<form action="<?php print strip_tags($_SERVER['php_SELF']);?>" method="post">
<fieldset>
<legend>Customer Information</legend>
<table width="249" border="0">
<tr>
<td><div align="left">First Name </div></td>
<td> Name: <input tabindex="1" name="name" type="text" id="name" value="<?php print $name;?>" /></td>
</tr>
<tr>
<td width="95"><div align="left">Last Name </div></td>
<td width="144"><input tabindex="1" name="lname" type="text" id="lname" /></td>
</tr>
<tr>