mazman13 Posted January 14, 2009 Share Posted January 14, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/140806-best-way-to-reuse-a-form/ Share on other sites More sharing options...
revraz Posted January 14, 2009 Share Posted January 14, 2009 include it? Quote Link to comment https://forums.phpfreaks.com/topic/140806-best-way-to-reuse-a-form/#findComment-736972 Share on other sites More sharing options...
premiso Posted January 14, 2009 Share Posted January 14, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/140806-best-way-to-reuse-a-form/#findComment-736973 Share on other sites More sharing options...
mazman13 Posted January 14, 2009 Author Share Posted January 14, 2009 can you give me an example of how that? i'm just trying to get my head around it. Quote Link to comment https://forums.phpfreaks.com/topic/140806-best-way-to-reuse-a-form/#findComment-737001 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.