php - How do I update the source code with mamp? -
i downloaded mamp 3 php 5.5.10. created new file php , put in htdocs folder , displayed correctly in chrome. added html , displayed nothing. checked source code , had 1 blank line. how fix displays html , php? also, why happen?
initial php was
<?php echo 'hi';?>
then changed
<!doctype html> <html> <head> <title>food</title> </head> <body> <?php echo 'hi'; ?> <form method="post" <?php echo "action=\"$_server['php_self']\"";?>> <input type="text" name="food" placeholder="enter food name"> <input type="submit" value="submit"> </form> </body> </html>
this line goofy:
<form method="post" <?php echo "action=\"$_server['php_self']\"";?>>
change to:
<form method="post" action="<?php echo $_server['php_self'];?>">
chances don't have error reporting turned on. otherwise you'd see this:
parse error: syntax error, unexpected '' (t_encapsed_and_whitespace), expecting identifier (t_string) or variable (t_variable) or number (t_num_string) in /applications/mamp/htdocs/test/index.php on line 10
turn on error reporting:
open /applications/mamp/bin/php/{your php version}/conf/php.ini.
find display_errors = off (around line 277) , change display_errors = on.
restart mamp.
borrowed error reporting instructions form here: http://gilbert.pellegrom.me/enable-php-error-reporting-in-mamp/
Comments
Post a Comment