Hi

It's been awhile since I had a question, thanks for helping me out before. Now I have another question.

I have 50 plus doctors that I have a DB table, I was told that I only needed one table but I could not figure out how. Well I figured it out.

I have one form and a register form that all my doctors fills out for placing orders.

The register form contains the names, username, passcode, room, bldg, etc.

what I want to do is when a doctor signs in his information is automatically filled in using the register information that was fill out at signup.


Before it was easy all I had to do is use $x_Investigator = "Name",
$x_Room = "604", etc.

Using one form for everyone makes it impossible to do that.

Does anyone know how I can have the form automatically populate with the information given in the registeration form?

Thanks
L:confused:

You will have to retrieve the registration info for the doctor from the database, and populate the current for with this information.

Are you familiar with SQL?

I know about SQL and seen what the code looks like when creating tables but that's it.

Are you saying I have to write a sql code that will populate my form? That would be way off my scope of knowledge but if you stir me the right direction I would appreciate it. Where would I find sample code to study from?

Thanks
Larry:-)

Take a look at PHP's docs on mysql_fetch_assoc() : http://www.php.net/manual/en/function.mysql-fetch-assoc.php

(I assume you're using MySQL. )

The first example on that page uses the following functions:

mysql_connect() - http://www.php.net/function.mysql-connect

this connects to your db.

mysql_query() - http://www.php.net/manual/en/function.mysql-query.php

This queries the mysql DB.

mysql_error() - http://www.php.net/manual/en/function.mysql-error.php

This echo's the last error message generated for your msql connection.

Finally,
mysql_fetch_assoc() - http://www.php.net/manual/en/function.mysql-fetch-assoc.php

This allows you to fetch an associative array of the rows in the query result.

Since you're already using a db, you should already have a database class? Just use it to select the row that matches the current doctor and fill in the form with the results..

Be a part of the DaniWeb community

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