MySQL Forums
Forum List  »  PHP

MM_Username insert into field
Posted by: James Halliwell
Date: March 09, 2013 05:36AM

Hi everyone,

new to php and Mysql, moved over from ms access, i am creating a website to help people monitor there requests, they login with a login name and password like

login 'James Helliwell',
password ABCDEF1

i have a form so they enter there details in but i want it to insert the login name (MM_Username) into a filed called Account Manager

i think its the below code from my site that i need to modify, teaching myself so any help would be grealty appreciated

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
$insertSQL = sprintf("INSERT INTO RequestsMaster (FieldSalesManager, AccountManager, AccountName, RequestMonth, `Module`, ModuleDescription, OrderQty, ApprovedByFSM, PotentialExtraBusiness, FinalApproval, ShippedStatus, ShippedDate) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['FieldSalesManager'], "text"),
GetSQLValueString($_POST['AccountManager'], "text"),
GetSQLValueString($_POST['AccountName'], "int"),
GetSQLValueString($_POST['RequestMonth'], "date"),
GetSQLValueString($_POST['Module'], "text"),
GetSQLValueString($_POST['ModuleDescription'], "text"),
GetSQLValueString($_POST['OrderQty'], "int"),
GetSQLValueString($_POST['ApprovedByFSM'], "int"),
GetSQLValueString($_POST['PotentialExtraBusiness'], "text"),
GetSQLValueString($_POST['FinalApproval'], "int"),
GetSQLValueString($_POST['ShippedStatus'], "text"),
GetSQLValueString($_POST['ShippedDate'], "date"));

mysql_select_db($database_DePuyConnection, $DePuyConnection);
$Result1 = mysql_query($insertSQL, $DePuyConnection) or die(mysql_error());

$insertGoTo = "Directory.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s", $insertGoTo));

Options: ReplyQuote

Written By
MM_Username insert into field
March 09, 2013 05:36AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.