Reputation: 1
i am new to PHP and started with installing xampp server and writing a php script. Everything looks good but when i click submit on the html form i am getting error (my apache and php admin both are running) "The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
Error 404 localhost Apache/2.4.29 (Win32) OpenSSL/1.0.2n PHP/5.6.33
Currently i am using windows 10 and placed my file ''test1' in htdocs folder in C://xampp. Below is my php code:
<?php
if(isset($POST["Submit"])){
$ETask=$POST["ETask"];
$Status=$POST["Status"];
$Connection=mysqli_connect('localhost','root','root');
$selected=mysqli_select_db('test',$Connection);
$Query="INSERT INTO test1(task,status) VALUES($ETask,$EStatus)";
$Execute=mysqli_query($Query);
if($Execute){
echo '<span class="success"> Records have been added successfully </span>';
}
else{
echo '<span>Please check db connection or error on the page </span>';
}
}
?>
<!DOCTYPE>
<html>
<head>
<title>Insert Into Database</title>
</head>
<body>
<div>
<form action="test1.php method="POST">
<fieldset>
Task : <br><input type="task" Name="ETask" value=""><br>
Status : <br><textarea Name="EStatus" ></textarea><br>
<br><br><input type="Submit" Name="Submit" value="Submit Your Status"><br>
</fieldset>
</form>
</div>
</html>
I have gone through several post but couldn't find solution. Comments & Suggestions are highly appreciated.
Upvotes: 0
Views: 1967
Reputation: 261
You missed to apply double quotes " closing in your form in html.<form action="test1.php" method="POST">
Upvotes: 0
Reputation: 11
Please change from:
<form action="test1.php method="POST">
To
<form action="test1.php" method="POST">
Upvotes: -1
Reputation: 2096
You missed "
quote in your form tag.
<form action="test1.php" method="POST">
Upvotes: 2