:S Hi I need help urgently.. I want to insert data into two mysql tables using just one form. Tried to do it through the following code below, but keep on getting horible errors when i submit. The essence is that the client has to fill all data without moving to another page after each submission.

I really need help PLease.

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
        $insertSQL = sprintf("INSERT INTO educate (applicant_id, ae_level, school, ae_from, ae_to, Qualification, updated_since) VALUES (%s, %s, %s, %s, %s, %s, %s)",
            GetSQLValueString($_POST['applicant_id'], "int"),
            GetSQLValueString($_POST['ae_level'], "text"),
            GetSQLValueString($_POST['school'], "text"),
            GetSQLValueString($_POST['ae_from'], "date"),
            GetSQLValueString($_POST['ae_to'], "date"),
            GetSQLValueString($_POST['Qualification'], "text"),
            GetSQLValueString($_POST['updated_since'], "date"));

       $insertSQL = sprintf("Insert Into reference (applicant_id, ref_one, ref_oneCon, ref_two, ref_twoCon, updated_since) Values(%s, %s, %s, %s, %s, %s)",
            GetSQLValueString($_POST['applicant_id'], "int"),
            GetSQLValueString($_POST['ref_one'], "text"),
            GetSQLValueString($_POST['ref_oneCon'], "text"),
            GetSQLValueString($_POST['ref_two'], "text"),
            GetSQLValueString($_POST[' ref_twoCon'], "text"),
            GetSQLValueString($_POST['updated_since'], "date"));

        mysql_select_db($database_rakes, $rakes);
        $Result1 = mysql_query($insertSQL, $rakes) or die(mysql_error());

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

With the following as the table;

<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
										<table width="100%" border="0" cellspacing="3" cellpadding="3">
										  <tr>
											<td width="50%">

                                                <table width="100%">
                                                    <tr valign="baseline">
                                                    <td nowrap align="right">Applicant:</td>
                                                    <td><select name="applicant_id">
                                                            <?php
                                                                do {
                                                                ?>
                                                            <option value="<?php echo $row_identify['applicant_id']?>" ><?php echo $row_identify['user_name']?></option>
                                                            <?php
                                                            } while ($row_identify = mysql_fetch_assoc($identify));
                                                        ?>
                                                        </select>
                                                    </td>
                                                    <tr>
                                                    <tr valign="baseline">
                                                        <td nowrap align="right">Educational Level:</td>
                                                        <td><select name="ae_level">
                                                                <option value="Doctorate" <?php if (!(strcmp("Doctorate", ""))) {echo "SELECTED";} ?>>Doctorate</option>
                                                                <option value="Masters Degree" <?php if (!(strcmp("Masters Degree", ""))) {echo "SELECTED";} ?>>Masters Degree</option>
                                                                <option value="Post Graduate Diploma" <?php if (!(strcmp("Post Graduate Diploma", ""))) {echo "SELECTED";} ?>>Post Graduate Diploma</option>
                                                                <option value="Diploma" <?php if (!(strcmp("Diploma", ""))) {echo "SELECTED";} ?>>Diploma</option>
                                                                <option value="Certificate" <?php if (!(strcmp("Certificate", ""))) {echo "SELECTED";} ?>>Certificate</option>
                                                                <option value="Senior High" <?php if (!(strcmp("Senior High", ""))) {echo "SELECTED";} ?>>Senior High</option>
                                                                <option value="Junior High" <?php if (!(strcmp("Junior High", ""))) {echo "SELECTED";} ?>>Junior High</option>
                                                            </select>
                                                        </td>
                                                    </tr>
                                                    <tr valign="baseline">
                                                        <td nowrap align="right">School:</td>
                                                        <td><input type="text" name="school" value="" size="32"></td>
                                                    </tr>
                                                    <tr valign="baseline">
                                                        <td nowrap align="right">From:</td>
                                                        <td><input type="text" name="ae_from" value="" size="32"></td>
                                                    </tr>
                                                    <tr valign="baseline">
                                                        <td nowrap align="right">To:</td>
                                                        <td><input type="text" name="ae_to" value="" size="32"></td>
                                                    </tr>
                                                    <tr valign="baseline">
                                                        <td nowrap align="right">Qualification:</td>
                                                        <td><input type="text" name="Qualification" value="" size="32"></td>
                                                    </tr>
                                                </table>
                                                <input type="hidden" name="updated_since" value="">
                                                <input type="hidden" name="MM_insert" value="form1">

											</td>
											<td valign="top" width="50%">
												<table width="100%" border="0" cellspacing="3" cellpadding="3">
												  <tr valign="baseline">
                                                        <td nowrap align="right">First Reference:</td>
                                                        <td><input type="text" name="ref_one" value="" size="32"></td>
                                                    </tr>
												  <tr valign="baseline">
                                                        <td nowrap align="right">1st Reference Contact:</td>
                                                        <td><input type="text" name="ref_oneCon" value="" size="32"></td>
                                                    </tr>
												  <tr valign="baseline">
                                                        <td nowrap align="right">Second Reference:</td>
                                                        <td><input type="text" name="ref_two" value="" size="32"></td>
                                                    </tr>
												  <tr valign="baseline">
                                                        <td nowrap align="right">2nd Reference Contact:</td>
                                                        <td><input type="text" name="ref_twoCon" value="" size="32"></td>
                                                    </tr>
												</table>
											</td>
										  </tr>
										  <tr>
											<td>&nbsp;</td>
											<td>&nbsp;</td>
										  </tr>
										</table>


                                                        <input class="buttom" type="submit" value="Insert Record">
 										</form>

Please submit the errors you are receiving. Thanks,
Andy.

copy and post the errors

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.