0

I'm pretty new to php and mysql. I have created an html form on one page. The action goes to another page which creates a table in a mysql database and enters all the info entered into the form. Then on the original page I call the table that was created and print the information to a table. This all works great.

My problem is that I need to include this form and table on about 6,000 pages. I would like to just use one action file, but create a different table name for each page.

Is it possible to have the table name a variable that I could change the value of on each form page and have it change automatically on the action page. Any help would be appreciated.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
karlh
  • 9
  • 3
  • 2
    Why do you need to create a separate table every time? – andrewsi Apr 02 '13 at 17:21
  • Because each page needs to display only the information that was entered on that page, not the others. Is there a way of doing this without each page having it's own table? – karlh Apr 02 '13 at 17:34
  • 1
    You just need to add an extra field "page_code" in your table. There is no need to use another table. – Jocelyn Apr 02 '13 at 17:36
  • I guess I don't understand. So if I add a field to the table called "page_code", then to call just the info entered on that page, would "page_code" need to be a variable that is set on the main page and transferred to the action page? – karlh Apr 02 '13 at 17:56
  • I got it. Thanks Jocelyn. I just had to sleep on it and realized what you were saying. – karlh Apr 03 '13 at 13:54

1 Answers1

0

I'm not sure why you want a different table name each time, but have you considered another table of names that may be associated with a table when you call it, or even give it a guid if you want each instance to have a unique name.

Petrovitch
  • 139
  • 3
  • 11