This is a discussion on "Form data to MySql" within the Introduce Yourself section. This forum, and the thread "Form data to MySql are both part of the Community category.
|
|
|
|
|
![]() |
||
Form data to MySql
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|
|
||||
|
Re: Form data to MySql
Would need some code to look at. Stripped of passwords etc of course if any.
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
|
||||
|
Re: Form data to MySql
Here is the code from the confirmation page....
<?php require_once('Connections/connPNAUK.php'); ?> <?php function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO information (SURNAME, FIRSTNAME, EMAIL, MIDDLENAME, DOB, MEMBER_CATEGORY, PNA_UK_EXPIRY, ADDRESS1, TOWN, COUNTY, POSTCODE, MOBILE_NUMBER, LANDLINE, UNIVERSITY, YEAR_GRAD, HIGHEST_EDUC, PRC_NUMBER, PRC_EXPIRY, BENEFICIARY, RELATIONSHIP, BENEFICIARY_ADDRESS, BENEFICIARY_CONTACT, HOSPITAL_OF_WORK, AREA_OF_WORK, `POSITION`, WORK_ADDRESS) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['surname'], "text"), GetSQLValueString($_POST['firstname'], "text"), GetSQLValueString($_POST['email'], "text"), GetSQLValueString($_POST['middlename'], "text"), GetSQLValueString($_POST['dob'], "text"), GetSQLValueString($_POST['membership'], "text"), GetSQLValueString($_POST['PNA_UK_EXPIRY'], "text"), GetSQLValueString($_POST['address'], "text"), GetSQLValueString($_POST['townI'], "text"), GetSQLValueString($_POST['county'], "text"), GetSQLValueString($_POST['postcode'], "text"), GetSQLValueString($_POST['mobile1'], "text"), GetSQLValueString($_POST['mobile2'], "text"), GetSQLValueString($_POST['university'], "text"), GetSQLValueString($_POST['yeargrad'], "text"), GetSQLValueString($_POST['educationI'], "text"), GetSQLValueString($_POST['prcid'], "text"), GetSQLValueString($_POST['prcexpiry'], "text"), GetSQLValueString($_POST['nok'], "text"), GetSQLValueString($_POST['relationship'], "text"), GetSQLValueString($_POST['nokaddress'], "text"), GetSQLValueString($_POST['nokcontactnumber'], "text"), GetSQLValueString($_POST['employer'], "text"), GetSQLValueString($_POST['areaofwork'], "text"), GetSQLValueString($_POST['position'], "text"), GetSQLValueString($_POST['employeraddress'], "text")); mysql_select_db($database_connPNAUK, $connPNAUK); $Result1 = mysql_query($insertSQL, $connPNAUK) or die(mysql_error()); $insertGoTo = "thankyou.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } $exp_dt_func = mktime(0, 0, 0, date("m"), date("d"), date("y")+1); $exp_dt = date("d-M-y", $exp_dt_func); ?> |
|
||||
|
Re: Form data to MySql
another code which is supposed to write to the mysql...
<?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_connPNAUK = "mysql8.streamline.net"; $database_connPNAUK = "databasname"; $table_connPNAUK = "tablename"; $username_connPNAUK = "username"; $password_connPNAUK = "password"; $connPNAUK = mysql_connect ("mysql8.streamline.net","databasename","password" ) or trigger_error(mysql_error(),E_USER_ERROR); ?> |
|
|||
|
Re: Form data to MySql
Have you tried printing out the errors returned from your attempts to communicate with the database? I'm assuming if your info isn't getting into the database, there is an error being generated somewhere along the way. |
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| mysql data loads once user login | longstand | PHP Forum | 9 | Feb 7th, 2008 07:10 |
| Sending Form Data to E-mail Address | Fools Gold | Starting Out | 4 | Dec 23rd, 2007 14:16 |
| About sending form-data to an email address | a.jenery | Web Page Design | 4 | Mar 3rd, 2006 12:17 |
| CGI that lists and sorts form data?? | pelachrum | Web Page Design | 3 | Aug 29th, 2005 07:51 |
| inserting data to mysql db | Tim356 | PHP Forum | 1 | May 6th, 2005 04:20 |