No obvious reason for double inserting.
You should clean any user input before use, see mysql_real_escape_string() below in the neatened code.
You should try and keep coding neat, it makes errors easier to find.
http://www.phpcodingstandards.com/php/
<?php
if ($_POST['softwarename']==""){
?>
<form action="<?php $_SERVER['PHP_SELF'] ;?>" method='post'>
<input type='text' name='softwarename' size=15>
<input type='submit' name='Submit Program' value='Add Program'></form>
<?php
}
else {
$con = mysql_connect("server","dbname","pass");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("dbname", $con);
$sname = mysql_real_escape_string ( $_POST['softwarename'] );
$sql="INSERT INTO addsoftware (softwarename)
VALUES ('" . $_POST['softwarename'] . "')";
if (!mysql_query($sql,$con)) {
echo "Form not sent, please click the back button on your browser to try again";
}
else {
echo "Software program added successfully!!";
}
}
?>