[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

How to pass a PHP array variable to an HTML Form Field.

Asked by jej1216 in PHP Scripting Language, Hypertext Markup Language (HTML)

Working with HTML, PHP, MySQL, Apache.  I have successfully written an HTML form that submits data to a PHP page which inserts the data to a MYSQL Database.  I also have a search HTML that hits another PHP page that displays the results of the search from the database.

I want the data displayed (there may be multiple rows) to be editable on a row-by-row basis.  How do I pass the array values from the PHP into an HTML Form section on the PHP page so the existing data from the db is defaulted into the form field which the user can then change?  Example: How do I get $myrow["fac_id"] from the PHP into a Form Field called "fac_id"?

This is my PHP section which correctly displays the results of the search:
[code]
<?php
$db = mysql_connect("localhost", "root", "yeahright"); mysql_select_db("mytest",$db);
$result = mysql_query("SELECT * FROM incidents WHERE incident_id = '$_REQUEST[incident_id]'",$db);
    echo "<table><tr>";
    echo "<td><b>Incident</b></td>";
    echo "<td><b>&nbsp Facility</b></td>";
    echo "<td><b>&nbsp Location</b></td>";
    echo "<td><b>&nbsp Other</b></td>";
    echo "<td><b>&nbsp Person</b></td>";
    echo "<td><b>&nbsp Name</b></td>";
    echo "<td><b>&nbsp Street</b></td>";
    echo "<td><b>&nbsp City</b></td>";
    echo "<td><b>&nbsp State</b></td>";
    echo "<td><b>&nbsp Zip</b></td>";
    echo "<td><b>&nbsp Phone</b></td>";
    echo "<td><b>&nbsp Birthdate</b></td></tr>";
    while ($myrow = mysql_fetch_array($result))
    {
       echo "<tr><td>".$myrow["incident_id"]."</td>";
       echo "<td> &nbsp ".$myrow["fac_id"]."</td>";
       echo "<td>&nbsp ".$myrow["room_descr"]."</td>";
       echo "<td>&nbsp;".$myrow["oth_descr"]."</td>";
       echo "<td>&nbsp ".$myrow["person_type"]."</td>";
       echo "<td>&nbsp;".$myrow["person_name"]."</td>";
       echo "<td>&nbsp;".$myrow["person_street"]."</td>";
       echo "<td>&nbsp;".$myrow["person_city"]."</td>";
       echo "<td>&nbsp;".$myrow["person_state"]."</td>";
       echo "<td>&nbsp;".$myrow["person_zip"]."</td>";
       echo "<td>&nbsp;".$myrow["person_phone"]."</td>";
       echo "<td>&nbsp;".$myrow["dob"]."</td></tr>";
       }
       echo "</tr></table>";
       $edit_fac_id=$myrow["fac_id"];
mysql_close($db);
?>
[/code]
After the PHP, my code is (doesn't work - fields are blank - I tried passing the array variables three diffferent ways):
[code]
<FORM NAME = "rm_edit_ir" METHOD="POST" ACTION="ir_updated.php">
<table border="0" cellpadding="0">
<tr><td>Facility:<br><INPUT TYPE=TEXT NAME="fac_id" DEFAULT=$edit_fac_id SIZE=12 MAXLENGTH=12></td>
<td>Location:<br><INPUT TYPE=TEXT NAME="room_descr" DEFAULT=$myrow["room_descr"] SIZE=32 MAXLENGTH=25></td>
<td>Other:<br><INPUT TYPE=TEXT NAME="oth_descr" DEFAULT=$myrow["oth_descr"] SIZE=32 MAXLENGTH=25></td>
</tr>
</table></FORM>
[/code]
TIA,

jej1216




[+][-]07/21/07 08:34 AM, ID: 19539630Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: PHP Scripting Language, Hypertext Markup Language (HTML)
Sign Up Now!
Solution Provided By: Computer101
Participating Experts: 3
Solution Grade: A
 
[+][-]05/30/07 10:05 AM, ID: 19181641Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/30/07 10:06 AM, ID: 19181644Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/30/07 10:09 AM, ID: 19181673Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05/30/07 12:38 PM, ID: 19182898Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/31/07 07:47 AM, ID: 19188568Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05/31/07 07:56 AM, ID: 19188661Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/04/07 01:34 PM, ID: 19211784Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/04/07 11:12 PM, ID: 19214870Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/17/07 03:44 AM, ID: 19503589Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92