I am trying to get this submit button to work correctly but my lack of knowladge of html and php has been stock
I have two submit buttons, if you click one it will allow you to edit the info and if you click the other one it should let you save it.
but the problem is that when you hit the "Save" one its not working right
<!-- This file creates new publications -->
<?php
include("../include/connect.inc.php");
?>
<html>
<head>
<title>Seagrant</title>
</head>
<body>
<!-- All data is checked for accuracy before saving it in this section -->
<?php
if($_POST["submit"])
{
include_once("../include/review.inc.php");
}
elseif($_POST['submit']== "save")
{
include_once("../include/savearticle.inc.php");
}else{
include_once("../include/publicationform.inc.php");
}
?>
</body>
</html>
That is the code that is suppose to catch which submit button is pressed.
This is the file "review.inc.php" and its where the 2 submit buttons are.
<!-----This file displays what the user has entered and gives the option to edit or save it.--->
<?php
$title = isset($_POST['title'])?$_POST['title']:"";
$auther = isset($_POST['auther'])?$_POST['auther']:"";
$description = isset($_POST['description'])?$_POST['description']:"";
$publication = isset($_POST['publication'])?$_POST['publication']:"";
$date = isset($_POST['date'])?$_POST['date']:"";
$abstract = isset($_POST['abstract'])?$_POST['abstract']:"";
$keywords = isset($_POST['keywords'])?$_POST['keywords']:"";
$affiliation = isset($_POST['affiliation'])?$_POST['affiliation']:"";
echo "<p><b>Title</b>: " . $title . "</p>";
echo "<p><b>Auther</b>: " . $auther . "</p>";
echo "<b>Description</b>: " . $description . "</p>";
echo "<p><b>Publication</b>: " . $publication . "</p>";
echo "<p><b>Date</b>: " . $date . "</p>";
echo "<p><b>Abstract</b>: " . $abstract . "</p>";
echo "<p><b>keywords</b>: " . $keywords . "</p>";
echo "<p><b>affiliation</b>: " . $affiliation . "</p>";
?>
<form action="" method="POST">
<p><input type="hidden" name ="title" value="<?php echo $title; ?>" /></p>
<p><input type="hidden" name="auther" value="<?php echo $auther; ?>" /></p>
<p><input type="hidden" name="description" value="<?php echo $description; ?>" /></p>
<p><input type="hidden" name="publication" value="<?php echo $publication; ?>" /></p>
<p><input type="hidden" name="date" value="<?php echo $date; ?>" /></p>
<p><input type="hidden" name="abstract" value="<?php echo $abstract; ?>" /></p>
<p><input type="hidden" name="keywords" value="<?php echo $keywords; ?>" /></p>
<p><input type="hidden" name="affiliation" value="<?php echo $affiliation; ?>" /></p>
<p><input type="submit" value="Edit" /></p>
<p><input type="submit" name = "Save" value="Save" /></p>
</form>
As you can see one is Edit and the other is Save. The SAVE one is not being caught properly by the if statements im not sure what im doing wrong please help me 😕
:queasy: