Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
Digital Lifestyle
Web Design and Hosting
PHP Contact Form - desparate for help
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="anynamewilldo" data-source="post: 1447786" data-attributes="member: 263577"><p>You really shouldn't have clients. </p><p></p><p>If you do the site correctly and professionally, the info from the form will go into the database automatically!! Someone has already typed it in - why should anyone have to type it in again? Screw sending the info via e-mail - insert it directly into the database.</p><p></p><p></p><p></p><p>There are MANY examples of how to do this on the web already. Have you looked?</p><p></p><p>A crude example of code for taking info from a form and putting it into a database. In this example, date_month, date_day and date_year are the names of form elements on the page that called the processing page. Note, this example is crude and incomplete but should get you started. </p><p></p><p>[code]</p><p><?</p><p>{ include 'setup.php' ; } //has database connection/login info</p><p></p><p>//submitted by form that calls this page - needs more robust untainting</p><p>$date_month = 0 + $_POST["date_month"];</p><p>$date_day = 0 + $_POST["date_day"];</p><p>$date_year = 0 + $_POST["date_year"];</p><p></p><p>$valueToInsert = $date_month."-".$date_day."-".$date_year ; </p><p></p><p>$param_array = array($valueToInsert);</p><p>$dbconn = pg_connect($host." ".$port." ".$dbname." ".$user." ".$password); </p><p>$result = pg_query_params($dbconn, $log_ins_stmt, $param_array); </p><p></p><p>?></p><p>[/code]</p></blockquote><p></p>
[QUOTE="anynamewilldo, post: 1447786, member: 263577"] You really shouldn't have clients. If you do the site correctly and professionally, the info from the form will go into the database automatically!! Someone has already typed it in - why should anyone have to type it in again? Screw sending the info via e-mail - insert it directly into the database. There are MANY examples of how to do this on the web already. Have you looked? A crude example of code for taking info from a form and putting it into a database. In this example, date_month, date_day and date_year are the names of form elements on the page that called the processing page. Note, this example is crude and incomplete but should get you started. [code] <? { include 'setup.php' ; } //has database connection/login info //submitted by form that calls this page - needs more robust untainting $date_month = 0 + $_POST["date_month"]; $date_day = 0 + $_POST["date_day"]; $date_year = 0 + $_POST["date_year"]; $valueToInsert = $date_month."-".$date_day."-".$date_year ; $param_array = array($valueToInsert); $dbconn = pg_connect($host." ".$port." ".$dbname." ".$user." ".$password); $result = pg_query_params($dbconn, $log_ins_stmt, $param_array); ?> [/code] [/QUOTE]
Verification
Name this item. 🏈
Post reply
Forums
Digital Lifestyle
Web Design and Hosting
PHP Contact Form - desparate for help
Top