Jump to content

Best way to reuse a form?


mazman13

Recommended Posts

I have a form that I have in the admin section of a site. This form is used for adding new companies to the database. I also have a drop down box below it showing all the companies currently in the db.

 

I want to use this page as an add/edit page. I want them to be able to click on a company in the drop down box and populate the form with the info from the drop down box so they can edit...but i also want to use the form from them to add info...

 

In the past I had two forms...one normal (for adding) and the another for editing field with php....but there has to be a better way than to call each form...

 

whats the best way?

Link to comment
Share on other sites

Make the form in it's own php file, then for the names have a variable $addOrEdit then define this in the main script what the user is doing then in the form php file have that variable set in the right places and viola the form works for both.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.