Hello all :)
I want when a user entres the requested data, the script to insert those data in the prope table depending on the choise the user does from the drop down menu.
Below is the code.
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
$site_type = $_REQUEST['category_selection'];
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "link_submission") && ($site_type = "Web_Sites")) {
$insertSQL = sprintf("INSERT INTO partner_sites (url, url_title, anchor_text, `description`, webmaster_name, webmaster_email, category) VALUES (%s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['url_field'], "text"),
GetSQLValueString($_POST['title_field'], "text"),
GetSQLValueString($_POST['anchor_field'], "text"),
GetSQLValueString($_POST['description_field'], "text"),
GetSQLValueString($_POST['webmaster_nane_field'], "text"),
GetSQLValueString($_POST['webmaster_email_field'], "text"),
GetSQLValueString($_POST['category_selection'], "text"));
mysql_select_db($database_content_conn, $content_conn);
$Result1 = mysql_query($insertSQL, $content_conn) or die(mysql_error());
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "link_submission") && ($site_type = "Blogs")) {
$insertSQL = sprintf("INSERT INTO partner_sites (url, url_title, anchor_text, `description`, webmaster_name, webmaster_email, category) VALUES (%s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['url_field'], "text"),
GetSQLValueString($_POST['title_field'], "text"),
GetSQLValueString($_POST['anchor_field'], "text"),
GetSQLValueString($_POST['description_field'], "text"),
GetSQLValueString($_POST['webmaster_nane_field'], "text"),
GetSQLValueString($_POST['webmaster_email_field'], "text"),
GetSQLValueString($_POST['category_selection'], "text"));
mysql_select_db($database_content_conn, $content_conn);
$Result1 = mysql_query($insertSQL, $content_conn) or die(mysql_error());
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "link_submission") && ($site_type = "Directories")) {
$insertSQL = sprintf("INSERT INTO partner_sites (url, url_title, anchor_text, `description`, webmaster_name, webmaster_email, category) VALUES (%s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['url_field'], "text"),
GetSQLValueString($_POST['title_field'], "text"),
GetSQLValueString($_POST['anchor_field'], "text"),
GetSQLValueString($_POST['description_field'], "text"),
GetSQLValueString($_POST['webmaster_nane_field'], "text"),
GetSQLValueString($_POST['webmaster_email_field'], "text"),
GetSQLValueString($_POST['category_selection'], "text"));
mysql_select_db($database_content_conn, $content_conn);
$Result1 = mysql_query($insertSQL, $content_conn) or die(mysql_error());
And below is the html code
<form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="link_submission" id="link_submission">
<table width="630" border="0" align="center" cellpadding="5" cellspacing="5">
<tr>
<td width="76">URL:*</td>
<td width="519"><label for="url_field"></label>
<span id="sprytextfield1">
<label for="url_field"></label>
<input name="url_field" type="text" id="url_field" size="50" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
</tr>
<tr>
<td>Anchor Text:*</td>
<td><label for="anchor_field"><span id="sprytextfield2">
<input type="text" name="anchor_field" id="anchor_field" />
<span class="textfieldRequiredMsg">A value is required.</span></span></label></td>
</tr>
<tr>
<td>URL Title:*</td>
<td><label for="title_field"><span id="sprytextfield3">
<input type="text" name="title_field" id="title_field" />
<span class="textfieldRequiredMsg">A value is required.</span></span></label></td>
</tr>
<tr>
<td>Description:*</td>
<td><span id="sprytextarea1">
<label for="description_field"></label>
<textarea name="description_field" id="description_field" cols="45" rows="3"></textarea>
<span id="countsprytextarea1"> </span><span class="textareaRequiredMsg">A value is required.</span><span class="textareaMaxCharsMsg">Exceeded maximum number of characters.</span></span></td>
</tr>
<tr>
<td>Webmaster Name:*</td>
<td><label for="textfield2"><span id="sprytextfield4">
<input type="text" name="webmaster_nane_field" id="webmaster_nane_field" />
<span class="textfieldRequiredMsg">A value is required.</span></span></label></td>
</tr>
<tr>
<td>Webmaster E-mail:*</td>
<td><label for="textfield3"><span id="sprytextfield5">
<input name="webmaster_email_field" type="text" id="webmaster_email_field" size="40" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></label></td>
</tr>
<tr>
<td>Category:*</td>
<td><span id="spryselect1">
<label for="category_selection"></label>
<select name="category_selection" id="category_selection">
<option>Select An Option</option>
<option value="Web_Sites">Web Sites</option>
<option value="Blogs">Blogs</option>
<option value="Directories">Directories</option>
</select>
<span class="selectRequiredMsg">Please select an item.</span></span></td>
</tr>
<tr>
<td> </td>
<td><label for="select"></label>
<input type="submit" name="button" id="button" value="Url Submission" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="link_submission" />
</form>
Can i have some help here please?\
Thanks in advance for any guidance.