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.
You missed " quote in your form tag.
<form action="test1.php" method="POST">
You missed to apply double quotes " closing in your form in html.<form action="test1.php" method="POST">
Please change from:
<form action="test1.php method="POST">
To
<form action="test1.php" method="POST">
Related
I'm a php starter, and i don't know what's wrong with my code, it's supposed to be a simple basic calculator, first i started a server with the command php -S localhost:4000 succesfully, i've been trying lots of code examples and they work fine, but this one doesn't:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form action="index.php" method="get">
Number 01: <input type="number" name="num1"><br>
Operation: <input type="text" name="op"><br>
Number 02: <input type="number" name="num2"><br>
<input type="submit"><br>
</form>
<?php
$num1=$_GET['num1'];
$num2=$_GET['num2'];
$result="";
$op=$_GET["op"];
if ($op=='+') {$result=$num1+$num2;}
if ($op=='-') {$result=$num1-$num2;}
if ($op=='*') {$result=$num1*$num2;}
if ($op=='/') {$result=$num1/$num2;}
echo "Result = $result";
?>
</body>
</html>
and the error i receive whenever i click submit query, another page shows up:
it says; ping service in the title, and a little frame appears:
Blocked by Content Security Policy
An error occurred during a connection to www.root-me.org.
Firefox prevented this page from loading in this way because the page
has a content security policy that disallows it.
I tried the code in an online php editor and same problem, is there something terribly wrong in my code, please help me! thank you
Problem Fixed
i changed the url from http://localhost:4000/site/ to http://localhost:4000/site/index.php
so the problem was actually in the form action attribute for he didn't recognize the index.php file!
Thank you
<?php
echo "hello";
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form action="/one1.php" method="POST" enctype="multipart/form-data">
<input type="file" name="image" />
<input type="submit"/>
</form>
</body>
</html>
`
I have a Url on my server
This url is working. I have written echo "hello" in this.
but when i go through in this url i have written the html file upload code
It says The requested URL [one1.php] was not found on this server.
I checked my file_upload is on.
Make sure your 'action' attribute on form tag is set to /one1.php
I got the answer I contact the hosting team. They told to off the mod security in my panel and things the worked.
Fairly new to PHP. Have been trying a simple program to get data from 2 fields and display it using GET method.
Heres the HTML code
<html>
<head>
<title>Simple Form</title>
</head>
<body>
<form action="send.php" method="get" id="sample">
Name:<input type="text" name="user"/>
Message:<input type="text" name="message"/>
<input type="submit"/>
</form>
</body>
</html>
Heres the PHP code:
<html>
<body>
Welcome <?php echo $_GET["user"]; ?>
Message <?php echo $_GET["message"]; ?>
</body>
</html>
The GET method fetches the data as a QueryString in address bar of browser, but doesn't display anything in browser window.
The code works perfectly. Reinstalling WAMP server solved the issue.
You need to start the server.
Go to your directory where the index.html file of your website lives, then run the command line php -S localhost:5000.
5000 is the port where php is listening to, you can put any value there....
Install php if you haven't.. Or Wamp
I have just started to learn HTML and PHP, but have run into a road block while following beginner tutorials. I am attempting to have the user input numbers into a form on the HTML page, then press submit to redirect to a PHP page that displays the values. The PHP page shows up and successfully displays prepared text but displays nothing for the values.
HTML code:
<html>
<body>
<head>
<title>Practice Page</title>
</head>
<h1>Numbers</h1>
<p>Put numbers in the boxes</p>
<form action="welcome.php" method="post">
NumOne: <input type="text" name="oynumone"><br>
NumTwo: <input type="text" name="oynumtwo"><br>
<input type="submit" value="Submit" id="SubmitRegister" name="submit" />
</form>
</body>
<html>
PHP code:
<html>
<body>
Number one is <?php echo $_POST["oynumone"]; ?><br>
Number two is <?php echo $_POST["oynumtwo"]; ?>
</body>
</html>
Both of the files are simply in the same folder in my documents. I understand that I need a server to host PHP content; I have downloaded MAMP for this, but I don't yet understand how to use it.
Any help would be most appreciated.
Store both file name with .php extension AND/OR update Welcome.php like below -
Welcome.php
<?php
if isset($_POST['submit'])
{
$oynumone = $_POST['oynumone'];
$oynumtwo = $_POST['oynumtwo'];
echo "Number one is ".$oynumone;
echo "Number two is ".$oynumtwo;
}
?>
Also check this
Im getting this error message using xampp i couldnt figure out if it was the code or i needed to configure something in xampp im using windows 7
it works usually but for some reason the _get crashes it i think
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
here is my php code
<?php
if (isset($_GET('day'))){
};
//echo $_get('day');
$text = 'Hello World.'
?>
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
<form action="index.php" method="GET">
day:<input type="text" name="day"value=""><br />
date:<input type="text" name="date"value=""><br />
name:<input type="text" name="name"value=""><br />
email:<input type="text" name="email"value=""><br />
<input type="submit"value = "submit">
</form >
</body>
</html>
i know this question has been asked before but i couldn't find a helpful answer