Hi Friends,
I have used submit button in but is there any other way to submit the form data using <a> tag in an form. ???
Moderators: macek, egami, gesf



<?php
if(isset($_POST['submit']))
{
$name2=$_POST['name1'];
$des=$_POST['desc1'];
$keyword=$des;
$keyword = str_replace("'","\'",$keyword);
$des=$keyword;
$db_table=$_POST['category'];
include("config.php"); //Data base connectivity
$temp_name = trim($name2); //trim white space
$temp_des = trim($des); //trim white space
if(empty($temp_name))
{
echo "<script type='text/javascript'>window.alert('Data not inserted. Article name filed should not left empty.')</script>";
}
if(empty($temp_des))
{
echo "<script type='text/javascript'>window.alert('Data not inserted. Description filed should not left empty.')</script>";
}
else
{
$insertdata = mysql_query("INSERT INTO $db_table values('','$name2','$des')");
echo "<center><span id='admin_success_msg' >Successfully saved</span></center>";
}
}
?>
<form action="" method="post" enctype="multipart/form-data">
<table id="table_admin" align="center">
<tr>
<td width="170">Select the Category you have to insert data</td><td>:</td>
<td>
<select name="category" id="category" >
<option value=''>--Select an Category--</option>
<option value='tamil'>Tamil</option>
<option value='telugu'>Telugu</option>
<option value='hindi'>Hindi</option>
<option value='spice'>Spice</option>
</select>
</td>
</tr>
<tr>
<td>Name of the Gallery</td><td>:</td><td><input type="text" name="name1"></td>
</tr>
<tr>
<td>Description about the Gallery</td><td>:</td><td><textarea rows="6" cols="40" name="desc1"></textarea></td>
</tr>
</table>
<table align="center" id="table_bottoms_admin">
<tr>
<td><input type="submit" value="Submit" name="submit"></td>
<td><input type="reset" value="Reset" name="clear" onClick="window.location.reload()"></td>
</table>
</form>
Users browsing this forum: No registered users and 1 guest