PHP experts!

Author
Discussion

Dave_ST220

Original Poster:

10,288 posts

204 months

Friday 1st July 2016
quotequote all
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

GreigM

6,726 posts

248 months

Friday 1st July 2016
quotequote all
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.

Dave_ST220

Original Poster:

10,288 posts

204 months

Friday 1st July 2016
quotequote all
If you fancy sorting it for some beer money please drop me a PM. There is a fellow PH'er who has been helping but he's a little busy at the moment (byebye Chris!). If you can code I'm sure it's pretty simple to get doing what I want (or if you know about Pay Pal Pro even better!!). Cheers

ZDW

60 posts

99 months

Friday 1st July 2016
quotequote all
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.





durbster

10,223 posts

221 months

Saturday 2nd July 2016
quotequote all
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

zippy3x

1,308 posts

266 months

Saturday 2nd July 2016
quotequote all
never forget little Bobby Tables

Dave_ST220

Original Poster:

10,288 posts

204 months

Saturday 2nd July 2016
quotequote all
To be honest it's over my head. If anyone fancies a little project please drop me a pm (assuming they are working!)