I am trying to update my database named publication with a form as created in data.html. And the file pubupdate.php is used to update the database which is linked through data.html.
While updating for the next time, table project and journal are not being updated at all while other table is getting updated and giving following error.
Notice: Undefined index: projid in C:\xampp\htdocs\Publication\pubupdate.php on line 16
Notice: Undefined index: papertitle in C:\xampp\htdocs\Publication\pubupdate.php on line 20
Notice: Undefined index: jtitle in C:\xampp\htdocs\Publication\pubupdate.php on line 30 Strange Error
I am posting both the codes, please help me out as I have already spent hell lot of time in debugging it. I am new to programming this.
data.html
<html>
<title> Publication v.0.0.1 </title>
<div align = "center">
<form action = "pubupdate.php" method = "post">
<p>Paper Type :<br> <select name="papertype"></p>
<option value="">Paper Type...</option>
<option value="journaltype">Journal</option>
<option value="conferencetype">Conference</option>
</select>
<br></br>
First Author : <br><input type = "text" name = "firstauthor">
<br></br>
Co-Authors : <br><input type = "text" name = "coauthor">
<br></br>
Title : <br><input type = "text" name = "ptitle">
<br></br>
Abstract : <br><textarea name = "abstract" rows = 10 cols = 50></textarea>
<br></br>
Conference / Journal Name : <br><input type = "text" name = "namecon">
<br></br>
Conference / Publication Date : <br> <input type = "text" name = "date">
<br></br>
Start Page No: <br><input type = "text" name = "startpage">
<br></br>
End Page No: <br> <input type = "text" name = "endpage">
<br></br>
Area: <br> <input type = "text" name = "area">
<br></br>
Project Name 1 : <br> <input type = "text" name = "projname1">
<br></br>
Project ID 1 : <br> <input type = "text" name = "projid1">
<br></br>
Contribution : <br> <select name="projcont1">
<option value="">Contribution...</option>
<option value="10">10 </option>
<option value="20">20</option>
</select>
<br></br>
Project Name 2 : <br> <input type = "text" name = "projname2">
<br></br>
Project ID 2 : <br> <input type = "text" name = "projid2">
<br></br>
Contribution : <br> <select name="projcont2">
<option value="">Contribution...</option>
<option value="10">10 </option>
</select>
<br></br>
ISSN : <br> <input type = "text" name = "issn">
<br></br>
Impact Factor : <br> <input type = "text" name = "imfac">
<br></br>
ISBN : <br> <input type = "text" name = "isbn">
<br></br>
SCI/ SSCI/ AHCI : <br><input type = "text" name = "sci">
<br></br>
Location : <br><select name="location">
<option value="">Location...</option>
<option value="domestic">Domestic</option>
</select>
<br></br>
Issue : <br><input type = "text" name = "issue">
<br></br>
Volume : <br><input type = "text" name = "volume">
<br></br>
Country : <br><select name="country">
<option value="">Country...</option>
<option value="AF">Afghanistan</option>
</select>
<br></br>
<input type ="submit" value ="Update this Publication List">
</form>
</div>
</html>
pubupdate.php
<?php
// Updating the values of Table "Paper"
$typereg = $_POST['papertype'];
$ptitlereg = $_POST['ptitle'];
$fauthorreg = $_POST['firstauthor'];
$coauthorreg = $_POST['coauthor'];
$abstractreg = $_POST['abstract'];
$nameconreg = $_POST['namecon'];
$areareg = $_POST['area'];
$datereg = $_POST['date'];
$startpagereg = $_POST['startpage'];
$endpagereg = $_POST['endpage'];
$projidreg = $_POST['projid'];
$countryreg = $_POST['country'];
// Updating the values of Table "Project"
$papertitlereg = $_POST['papertitle'];
$projname1reg = $_POST['projname1'];
$projid1reg = $_POST['projid1'];
$projcont1reg = $_POST['projcont1'];
$projname2reg = $_POST['projname2'];
$projid2reg = $_POST['projid2'];
$projcont2reg = $_POST['projcont2'];
// Updating the values of Table "Journal"
$issnreg = $_POST['issn'];
$jtitlereg = $_POST['jtitle'];
$imfacreg = $_POST['imfac'];
$isbnreg = $_POST['isbn'];
$scireg = $_POST['sci'];
$locationreg = $_POST['location'];
$issuereg = $_POST['issue'];
$volumereg = $_POST['volume'];
// Create Local variable
$taken = "false";
$database = "publication";
$password = "";
$username = "root";
// Connect to database
$con = mysql_connect('localhost', $username, $password) or die("Unable to connect database");
@mysql_select_db($database, $con) or die("Unable to connect");
mysql_query("INSERT INTO `paper` VALUES('$typereg', '$ptitlereg','$fauthorreg','$coauthorreg','$abstractreg' ,'$nameconreg', '$areareg','$datereg', '$startpagereg', '$endpagereg','','$countryreg' )") or die("Strange Error");
mysql_query("INSERT INTO `journal` VALUES('$issnreg', '','$imfacreg','$isbnreg','$scireg' ,'$locationreg', '$issuereg','$volumereg')") or die("Strange Error");
mysql_query("INSERT INTO `project` VALUES( '','$projname1reg','$projid1reg','$projcont1reg' ,'$projname2reg', '$projid2reg','$projcont2reg')") or die("Strange Error");
echo "Account Created";
mysql_close($con);
header('Location: home.php');
?>