I have a form where user enters category, it gets inserted into db and it has to go to other page to select an image, after selection image id has to get into category table.
I am doing some thing like this
<?php
error_reporting(E_ALL ^ E_NOTICE);
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("mydocair", $con);
$ThirdPartyCategoryName =$_POST['ThirdPartyCategoryName'];
$checkformembers = mysql_query("SELECT * FROM thirdpartycategorymaster WHERE ThirdPartyCategoryName = '$ThirdPartyCategoryName'");
if(mysql_num_rows($checkformembers) != 0)
{
header('location:newcat.php?msg=category exists');
}
else
{
$sql="INSERT INTO thirdpartycategorymaster (ThirdPartyCategoryID, ThirdPartyCategoryName)
VALUES
('$_POST[ThirdPartyCategoryID]',
'$_POST[ThirdPartyCategoryName]'
)";
}
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
mysql_close($con);
?>
<?php
$res = mysql_query("SELECT ThirdPartyCategoryID FROM thirdpartycategorymaster");
while($row = mysql_fetch_array($res))
{
"<script type='text/javascript'>
if(window.confirm("Do you want to insert image for category?")) {
document.location = "imgcat.php?id="<?php echo row2['ThirdPartyCategoryID']; ?>""
}
</script>";
}
?>