Simple PHP echo code not working
Any of these (or more) could be your answer why it is not working
- Is there actually PHP running on your computer?
- Is the file extension
.php
? - Are you accesing the file through your browser doing something like
http://localhost/myfile.php
- If it is on a remote server, is there PHP installed?
Simple PHP echo code not working
Any of these (or more) could be your answer why it is not working
- Is there actually PHP running on your computer?
- Is the file extension
.php
? - Are you accesing the file through your browser doing something like
http://localhost/myfile.php
- If it is on a remote server, is there PHP installed?
simple PHP echo not working
I recommend you start learning PHP using this website http://www.developphp.com/list_php.php#Getting_Started_with_PHP_Programming it has everything you need to get you started, tutorials are nice and easy to follow :)
Check the Installation section and then maybe have a look at this one http://www.developphp.com/view_lesson.php?v=194 to solve your problem.
Hope it helps!- Good Luck!
Simple PHP code not working
If you look at "View source" you will likely see the < ?php-tags, meaning PHP is not executed.
If your file called something.php then the settings on your WAMP is wrong, somehow.
Unable to echo or print from PHP functions
Just use keep your code inside a function and call the function name while post your input
Ex:
function yourFunctionName(){
if (array_key_exists("saveData", $_POST)) {
$saveData = $_POST['saveData'];
$token = $_COOKIE['validToken'];
$token = mysqli_real_escape_string($link, $token);
$query = "UPDATE userData SET saveData = '$saveData' WHERE token = '$token' LIMIT 1";
mysqli_query($link, $query);
}
if (array_key_exists("logSubmit", $_POST)) {
$email = $_POST["logEmail"];
$email = filter_var($email, FILTER_SANITIZE_EMAIL); // Clean Email
$email = filter_var($email, FILTER_VALIDATE_EMAIL); // Confirm Valid Email
$query = "SELECT saveData FROM userData WHERE email = '$email' LIMIT 1";
$loadData = mysqli_query($link, $query);
echo("SALO Ready!");
}
}
PHP code is not being executed, but the code shows in the browser source code
Sounds like there is something wrong with your configuration, here are a few things you can check:
Make sure that PHP is installed and running correctly. This may sound silly, but you never know. An easy way to check is to run
php -v
from a command line and see if returns version information or any errors.Make sure that the PHP module is listed and uncommented inside of your Apache's httpd.conf This should be something like
LoadModule php5_module "c:/php/php5apache2_2.dll"
in the file. Search forLoadModule php
, and make sure that there is no comment (;
) in front of it.Make sure that Apache's httpd.conf file has the PHP MIME type in it. This should be something like
AddType application/x-httpd-php .php
. This tells Apache to run.php
files as PHP. Search for AddType, and then make sure there is an entry for PHP, and that it is uncommented.Make sure your file has the
.php
extension on it, or whichever extension specified in the MIME definition in point #3, otherwise it will not be executed as PHP.Make sure you are not using short tags in the PHP file (
<?
), these are not enabled on all servers by default and their use is discouraged. Use<?php
instead (or enable short tags in your php.ini withshort_open_tag=On
if you have code that relies on them).Make sure you are accessing your file over your webserver using an URL like
http://localhost/file.php
not via local file accessfile://localhost/www/file.php
And lastly check the PHP manual for further setup tips.
Related Topics
Simplexml Get Element Content Based on Attribute Value
Programmatically Determine Whether to Describe an Object with "A" or "An"
Get Number of Rows Matched by Update Query with PHP MySQLi
Commenting Interpreted Code and Performance
Why Preg_Replace Throws Me a "Unknown Modifier" Error
Explode a Paragraph into Sentences in PHP
Using Windows Authentication with PHP
PHP Timezone Database Is Corrupt Error
Laravel 4.1: How to Paginate Eloquent Eager Relationship
How to Use an Object Method as a Callback Function
How to Read a .Txt File with PHP
PHP File_Get_Contents Does Not Work on Localhost
How to Protect My Source Code When Deployed
How to Set Short Tag(<) in PHP
PHP Array_Intersect() Efficiency
Parse Error: Syntax Error, Unexpected '' (T_Encapsed_And_Whitespace)