php and html

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
ARman
New php-forum User
New php-forum User
Posts: 1
Joined: Mon Jul 30, 2018 1:31 am

Mon Jul 30, 2018 8:10 am

Hello guys , I'm new to php and i want to run some simple code to see how it works but i have problem with receiving the processing result
this is the code of my HTML :

Code: Select all

<!DOCTYPE html>
<html>
    <body>

<form method="POST" action ="index.php" >
    Name: <input type="text" name="fname">
    <input type="submit" value="Submit">

</form>

 <body>
     <html>
     
and this is the php code :

Code: Select all

<?php
   if ($_SERVER["REQUEST_METHOD"]=="POST") { 
     echo " we received your name"; 
 }
?>
and the result i get is the code i have write in php file i mean the exact code , it just send back the code instead of processing it . i don't know if my code has some problem or it's some thing else . i wonder if u can help me with it...

User avatar
hyper
php-forum Fan User
php-forum Fan User
Posts: 719
Joined: Mon Feb 22, 2016 5:52 pm

Mon Jul 30, 2018 10:11 am

Your code needs to be in the correct folder and will probably need the .php extension.

You should have received instructions when you loaded your server software (apache?) where to put your files.

avored
New php-forum User
New php-forum User
Posts: 1
Joined: Tue Aug 07, 2018 2:42 pm

Tue Aug 07, 2018 2:48 pm

Make sure your file extension is .php
AvoRed a Laravel E-commerce

Post Reply