Buenas tardes,  tengo este codigo y quiero saber que debo hacer para que valide si inserta los datos o no. e imprima  el mensaje que esta en rojo y si no inserta que salga uno parecido donde diga que  no fue ingresado y que intente de nuevo
 
 <?php
if($enviar)
{
$con = mysql_connect("localhost","root","root");
mysql_select_db("laboratorio",$con);
$sql= "INSERT INTO lamsofci (id_softw,id_versi,id_casas,tp_seria,tp_siope,nu_c  ds,de_softw,de_versi) VALUES ('$id_softw','$id_versi','$id_casas','$tp_seria','  $tp_siope','$nu_cds','$de_softw','$de_versi')";
$result = mysql_query($sql);
 
 
 echo "<script type=\"text/javascript\">alert(\"Dantos Ingresados\");</script>";
 
 
 ?>
<center>
<h3><font color=Black><a href='software.php'>Aceptar</a></font></h3>
</center>
<?php
 
}
else
{
 ?>
<form name='menu' method='post' action='software.php'>
<table height="440"><tr><td></td>
<td></td>
<td></td>
<fieldset>
<td><fieldset><legend><font color=Blue ><H6>INGRESO DE SOFTWARE</font></legend><BR>
 
<fieldset><table width="158">
<tr><td width="1"></td><td width="83"><font color=Black><h6>CODIGO DE SOFTWARE:</font></td>
              <td width="58"><input type='Text' name='id_softw' size='6' maxlength='6'></td>
            </tr>
</table></fieldset><br>
<fieldset><table width="589">
              <tr>
 
    <td width="114"><font color=Black><h6>CODIGO DE VERSION:</td>
       <td width="89"><input type='Text' name='id_versi' size='6' maxlength='6'></font></td>
 
             <td width="111"><font color=Black><h6> CASA DE SOFTWARE:</td>
        <td width="83"><select name='id_casas' id='id_casas' >
       <option  value= 'N/A' >.....</option>
 
 <?php
$con = mysql_connect("localhost","root","root");
mysql_select_db("laboratorio",$con);
 
$sql="select id_casas, de_casas from lamcassf";
$respuesta= Mysql_query ($sql, $con);
while ($row= Mysql_fetch_array ($respuesta))
	echo "<option value='".$row["id_casas"]."'>" . $row["de_casas"].  "</option>\n";
 
echo "</select>";
 ?>
 
 
 </select></td></tr>
 </table></fieldset><br>
<fieldset><table>
<tr>
    <td width="210" height="49"><font color=Red><h6>MANEJA SERIAL DE ACTIVACION?:</font></td>
       <td width="150"><select name='tp_seria' id='tp_seria' >
       <option  value= 'S/N' >.....</option>
       <option  value= 'S' >SI</option>
       <option  value= 'N' >NO</option></select></td>
 
    <td width="111"><font color=Red><h6>ES SISTEMA OPERATIVO?:</font></td>
       <td width="281"><select name='tp_siope' id='tp_siope' >
       <option  value= 'S/N' >.....</option>
       <option  value= 'S' >SI</option>
       <option  value= 'N' >NO</option></select></td></tr>
    </table></fieldset><br>
    <fieldset><table>
<tr>
    <td width="100"><font color=Black><h6>CANTIDAD DE CDS:</font></td>
       <td width="36" ><input type='Text' name='nu_cds' size='6' maxlength='6'></td>
                </tr>
                </table></fieldset><br>
 
                <fieldset><table>
<tr><td width="90"><font color=Black><h6>DESCRIPCION DEL SOFTWARE:</font></td>
              <td width="80"><input type=hidden name=subject value="opinión">
<P><TEXTAREA id=TEXTAREA1 style="WIDTH: 150px; HEIGHT: 70px" name="de_softw" rows=10 cols=36>
</TEXTAREA></td><TD width="50"></TD>
<td width="90"><font color=Black><h6>DESCRIPCION DE VERSION:</font></td>
              <td width="80"><input type=hidden name=subject value="opinión">
<P><TEXTAREA id=TEXTAREA1 style="WIDTH: 150px; HEIGHT: 70px" name="de_versi" rows=10 cols=36>
</TEXTAREA></td>
            </tr>
</table></fieldset><br>
 
      <tr></tr>
  <tr><td ></d>  <td ></d> <td ></d> <td width="500" > <center><input type='Submit' name='enviar' value = 'Guardar'></center></d>
    </tr>
  </table>
  </form>
  </div>
 <?php
}
 ?> 
   
 
 Como verificar si un dato fue ingresado a la bd?
 Como verificar si un dato fue ingresado a la bd? 



