Design ?: Fetch info->confirm->enter into database
Posted: Fri Feb 11, 2011 10:14 am
I am new to PHP. I am trying to put together some code that will take some info (a book title, author from xml) and insert some of the info into a database. So far I have the code that will fetch and strip the info and display it, but I want a confirmation page before it is sent to a database. Basically I have two questions:
1) What is some crude code that will take existing data in variables, create a confirm button for the user and then insert the info into the database. (Remember, beginner here. I don't need anything really detailed, I can look up the details, I'm just having problems with this confirmation button.)
1) How many files should I have for this? When I install php code from major products I usually see dozens of .php files. How do I know when I should create another file? So in my case I have a single page that will take some html input, I have a request page that fetches the xml, parses, and then outputs the result. I assume this will also be the confirmation page asking the user if they want to insert this into the database. So I have:
askinfo.php - html for post variable
processrequest.php - fetches xml, parses xml, displays info, asks for confirm, AND inserts into database?
I guess when to create a new file isn't obvious to me. Aside from organization is there a reason why giant php projects don't just have one giant file? Is there something inherent to php which prevents this.
Thanks!
jack
1) What is some crude code that will take existing data in variables, create a confirm button for the user and then insert the info into the database. (Remember, beginner here. I don't need anything really detailed, I can look up the details, I'm just having problems with this confirmation button.)
1) How many files should I have for this? When I install php code from major products I usually see dozens of .php files. How do I know when I should create another file? So in my case I have a single page that will take some html input, I have a request page that fetches the xml, parses, and then outputs the result. I assume this will also be the confirmation page asking the user if they want to insert this into the database. So I have:
askinfo.php - html for post variable
processrequest.php - fetches xml, parses xml, displays info, asks for confirm, AND inserts into database?
I guess when to create a new file isn't obvious to me. Aside from organization is there a reason why giant php projects don't just have one giant file? Is there something inherent to php which prevents this.
Thanks!
jack