Discussion
First off I'm NOT a programmer but can follow instructions! I have a form with various fields, eg :-
<td><?php echo $_SESSION['errorarray'][14]; ?><input type="text" name="BillingPhone" size="20" tabindex="9" value="<?php echo $_SESSION['BillingPhone']; ?>" /></td>
what I now want to do is store whatever is entered in the form in a database (when the form is submitted). I'm guessing I need to add a column in the DB and have a post command so that is done? Or am I completely off here?!!
Thanks
<td><?php echo $_SESSION['errorarray'][14]; ?><input type="text" name="BillingPhone" size="20" tabindex="9" value="<?php echo $_SESSION['BillingPhone']; ?>" /></td>
what I now want to do is store whatever is entered in the form in a database (when the form is submitted). I'm guessing I need to add a column in the DB and have a post command so that is done? Or am I completely off here?!!
Thanks
There's a lot of information missing there, are you adding another column/field to an existing function or is this a new function with new table etc?
Fundamentally however, yes - you have one page (php or plain HTML) which sets provides the form to the user, when the user hits the submit button this does either a POST/GET to a php page which reads the parameters and creates/executes the SQL statement to insert the data to the database.
Fundamentally however, yes - you have one page (php or plain HTML) which sets provides the form to the user, when the user hits the submit button this does either a POST/GET to a php page which reads the parameters and creates/executes the SQL statement to insert the data to the database.
You'll be needing one or more tables (depending on your data) to store the data. You'll either be inserting a new row in your table or updating and existing one. Each othe the data items will be going into its respective column in the table row.
Since you're already trying yourself this will maybe help guide you:
http://www.w3schools.com/php/php_mysql_insert.asp
If your site is going to be publicly accessible, then please please make sure you clean and validate any information you insert into your database. Search for 'SQL Injection' to find out why.
Since you're already trying yourself this will maybe help guide you:
http://www.w3schools.com/php/php_mysql_insert.asp
If your site is going to be publicly accessible, then please please make sure you clean and validate any information you insert into your database. Search for 'SQL Injection' to find out why.
Have a look at Medoo. It's a lovely little framework for PHP database connections, and avoids the rather messy standard PHP database interface.
http://medoo.in
http://medoo.in
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff