+ 4

connection between HTML and PHP

Hi, I create php code and HTML code, How can I connect them together, I call My PHP in HTML code , but it doesn't know my PHP project and I got error 404, does any one has any solution?

9th Nov 2018, 2:23 PM
Gilda
4 Respuestas
+ 4
Sorry for late answer, it seems yeah somehow it doesnt work in SL There's a flaw in your code 1. Make sure your get is not empty before using, you can wrap it in if(isset[$_GET['name'] && isset[$_GET['age']){} 2. if you want to send the data to the same page, action attributes needs to be empty And always remember the code are running in the server, not realtime in the browser like javascript does
9th Nov 2018, 7:10 PM
Taste
Taste - avatar
+ 1
Both are usually used in single file How did you do it ?
9th Nov 2018, 2:31 PM
Taste
Taste - avatar
0
I did it but I got this error : PHP Notice: Undefined index: name in ..\Playground\ PHP Notice: Undefined index: age in ..\Playground\
9th Nov 2018, 2:35 PM
Gilda
0
my code is this: <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <?php echo "Hi ".$_GET['name'].". "; echo "You are ".$_GET['age']." years old."; ?> <body> <form action="first.php" method="post"> <p>Name: <input type="text" name="name" /></p> <p>Age: <input type="text" name="age" /></p> <p><input type="submit" name="submit" value="Submit" /></p> </form> </body> </html>
9th Nov 2018, 2:35 PM
Gilda