General question - how would you do this??? 
Author Message
 General question - how would you do this???


  I'm working on my first app and am just about ready to get things going
but I have one question that I can't seem to find a solution for, so I
turn to you all for advice.

  I have one table with subscriber info (name, phone, etc...), two seperate
tables keeps the info for the subscriber's clergy and doctors.  So I have
the 'subscriber' , 'clergy', and 'doctors' tables.

  My question is, during the entry of a new subscriber using a form, I
would like to generate a pick list of doctors and clergy for the data
entry person to choose from, that's no problem.  But, how would you
handle the dynamic addition of a clergy or doctor record if they did not
already show up in the pick list???  

  I can think of one way and that is to have a selection item like "New
doctor".  They fill out the rest of the form and when it is submited, if
doctor='new' then cache the previous form ('cause I can't input it into
the database without a doctor ID), have them enter in the new doctor info
in a seperate form and when they then press submit for that, input the
doctor info into the doctor table, get the new ID and then input the info
from the original subscriber form with the new doctor id.  

  Is that the best way?  How should I store the cached form info while
the new doctor (or clergy) form is being edited?  Should I create a table
on the fly to hold the cached form info and the copy to the 'subscribers'
table once I have the new doctor or clergy id?

  Might not exactly be a PHP specific question, but I'll ask here anyway.


Sun, 29 May 2005 11:28:48 GMT  
 General question - how would you do this???
Sessions and arrays are your friends.

Specifically, have your form built using arrays:

Instead of:
<input type='text' name='name'>
<input type='text' name='address'>
<input type='text' name='phone'>

<input type='text' name='info[name]'>
<input type='text' name='info[address]'>
<input type='text' name='info[phone]'>

when you submit, all your data will be in the $info array
(or more precisely $_POST['info'] array)

Now just store that array into a session

$_SESSION['info'] = $_POST['info'];

when you want to get at the variables directly 'old style'
again, use extract()

echo $name, $address, $phone;

Michael Kimsal
Guaranteed PHP support when you need it!

Sun, 29 May 2005 12:05:46 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Doing assembly and really doing assembly

2. Doing assembly and really doing assembly

3. another General publicly calling to drop Ada (drop the General instead :-)

4. Stupid newb question: What am I doing wrong?

5. Newbie Question - Usual ways of doing th

6. Newbie Question - Usual ways of doing things.

7. Newbee Template question - Can this be done?

8. what am i doing wrong? HLA question

9. Simple Newbie Question: What am I doing wrong?

10. Embedding question (doing Python from C)

11. Question: Hiding TK app while doing an exec

12. Some General Questions about J


Powered by phpBB® Forum Software