Hi Jcck, here is an example of how I'm connecting to the database to complete a registration process. What I'm trying to get at is where to insert the relevant email code. <?php require_once('../Connections/casu.php'); ?><?php session_start(); 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 = $HTTP_SERVER_VARS['PHP_SELF']; if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING']; } if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE users SET user_name=%s, fName=%s, sName=%s, job=%s, org=%s, org_type=%s, address=%s, postCode=%s, tel=%s, email=%s, c_of_c=%s, newsletter=%s, appTime=%s, group_id=%s, status=%s, drowssap=%s WHERE id=%s", GetSQLValueString($HTTP_POST_VARS['user_name'], "text"), GetSQLValueString($HTTP_POST_VARS['fName'], "text"), GetSQLValueString($HTTP_POST_VARS['sName'], "text"), GetSQLValueString($HTTP_POST_VARS['job'], "text"), GetSQLValueString($HTTP_POST_VARS['org'], "text"), GetSQLValueString($HTTP_POST_VARS['org_type'], "text"), GetSQLValueString($HTTP_POST_VARS['address'], "text"), GetSQLValueString($HTTP_POST_VARS['postCode'], "text"), GetSQLValueString($HTTP_POST_VARS['tel'], "text"), GetSQLValueString($HTTP_POST_VARS['email'], "text"), GetSQLValueString(isset($HTTP_POST_VARS['c_of_c']) ? "true" : "", "defined","'Y'","'N'"), GetSQLValueString(isset($HTTP_POST_VARS['newsletter']) ? "true" : "", "defined","'Y'","'N'"), GetSQLValueString($HTTP_POST_VARS['appTime'], "date"), GetSQLValueString($HTTP_POST_VARS['group_id'], "int"), GetSQLValueString($HTTP_POST_VARS['status'], "int"), GetSQLValueString($HTTP_POST_VARS['drowssap'], "text"), GetSQLValueString($HTTP_POST_VARS['id'], "int")); mysql_select_db($database_casu, $casu); $Result1 = mysql_query($updateSQL, $casu) or die(mysql_error()); $updateGoTo = "new_member.php"; if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } ?> <?php $varSearch_rsUserDetails = "1"; if (isset($HTTP_SESSION_VARS['userSession'])) { $varSearch_rsUserDetails = (get_magic_quotes_gpc()) ? $HTTP_SESSION_VARS['userSession'] : addslashes($HTTP_SESSION_VARS['userSession']); } mysql_select_db($database_casu, $casu); $query_rsUserDetails = sprintf("SELECT * FROM users WHERE id = '%s'", $varSearch_rsUserDetails); $rsUserDetails = mysql_query($query_rsUserDetails, $casu) or die(mysql_error()); $row_rsUserDetails = mysql_fetch_assoc($rsUserDetails); $totalRows_rsUserDetails = mysql_num_rows($rsUserDetails); ?> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <form method="post" name="form1" action="<?php echo $editFormAction; ?>"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Id:</td> <td><?php echo $row_rsUserDetails['id']; ?></td> </tr> <tr valign="baseline"> <td nowrap align="right">User_name:</td> <td><input type="text" name="user_name" value="<?php echo $row_rsUserDetails['user_name']; ?>" size="32"> </td> </tr> <tr valign="baseline"> <td nowrap align="right">FName:</td> <td><input type="text" name="fName" value="<?php echo $row_rsUserDetails['fName']; ?>" size="32"> </td> </tr> <tr valign="baseline"> <td nowrap align="right">SName:</td> <td><input type="text" name="sName" value="<?php echo $row_rsUserDetails['sName']; ?>" size="32"> </td> </tr> <tr valign="baseline"> <td nowrap align="right">Job:</td> <td><input type="text" name="job" value="<?php echo $row_rsUserDetails['job']; ?>" size="32"> </td> </tr> <tr valign="baseline"> <td nowrap align="right">Org:</td> <td><input type="text" name="org" value="<?php echo $row_rsUserDetails['org']; ?>" size="32"> </td> </tr> <tr valign="baseline"> <td nowrap align="right">Org_type:</td> <td><input type="text" name="org_type" value="<?php echo $row_rsUserDetails['org_type']; ?>" size="32"> </td> </tr> <tr valign="baseline"> <td nowrap align="right" valign="top">Address:</td> <td> <textarea name="address" cols="50" rows="5"><?php echo $row_rsUserDetails['address']; ?></textarea> </td> </tr> <tr valign="baseline"> <td nowrap align="right">PostCode:</td> <td><input type="text" name="postCode" value="<?php echo $row_rsUserDetails['postCode']; ?>" size="32"> </td> </tr> <tr valign="baseline"> <td nowrap align="right">Tel:</td> <td><input type="text" name="tel" value="<?php echo $row_rsUserDetails['tel']; ?>" size="32"> </td> </tr> <tr valign="baseline"> <td nowrap align="right">Email:</td> <td><input type="text" name="email" value="<?php echo $row_rsUserDetails['email']; ?>" size="32"> </td> </tr> <tr valign="baseline"> <td nowrap align="right">C_of_c:</td> <td><input type="checkbox" name="c_of_c" value="" <?php if (!(strcmp($row_rsUserDetails['c_of_c'],""))) {echo "checked";} ?>> </td> </tr> <tr valign="baseline"> <td nowrap align="right">Newsletter:</td> <td><input type="checkbox" name="newsletter" value="" <?php if (!(strcmp($row_rsUserDetails['newsletter'],""))) {echo "checked";} ?>> </td> </tr> <tr valign="baseline"> <td nowrap align="right"> </td> <td><input type="submit" value="Complete Registration"> </td> </tr> </table> <input type="hidden" name="appTime" value="<?php echo $row_rsUserDetails['appTime']; ?>"> <input type="hidden" name="group_id" value="<?php echo $row_rsUserDetails['group_id']; ?>"> <input type="hidden" name="status" value="<?php echo $row_rsUserDetails['status']; ?>"> <input type="hidden" name="drowssap" value="<?php echo $row_rsUserDetails['drowssap']; ?>"> <input type="hidden" name="MM_update" value="form1"> <input type="hidden" name="id" value="<?php echo $row_rsUserDetails['id']; ?>"> </form> <p> </p> </body> </html> <?php mysql_free_result($rsUserDetails); ?> "Jacob A. Van Zanen" <jack@vanzanen.com> wrote in message 30FB69E987A8D611B45900104BC18D47259343@PDCQ">news:30FB69E987A8D611B45900104BC18D47259343@PDCQ... > > Hi, > > > Combine the two scripts > > Begin script > Accept the post variables > Insert them into the database > Mail them > End script > > > jack > > > -----Original Message----- > From: Philip O'Rourke [mailto:phil@casu.org.uk] > Sent: Tuesday, September 16, 2003 10:46 AM > To: php-db@lists.php.net > Subject: Email Form > > > I am new to PHP and need some help with an form mail problem. Basically > i know how to get a form to submit data to MySQL and I know how email > the content of a form. But how do i get a form to do both? > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php