Hello everyone!
I am pretty new to programming but i have learned CSS and HTML(yes, i know, no biggie :P).
I am now learning PHP and i sometimes fall into situations where i do not know who to ask my questions to so i was looking for a community to join where i can seek help!
So this might be very easy for some of you but here i go with my first question!
I have been working on this small “program” where you can enter your name and click submit.
If no name was entered and the submit was hit, it should say “Please enter name”.
If a name was set, then it should write it down, after creating the new file for it, in the names.txt file.
Right now, it is not working and i have no idea why.
Here is the code:
[php]<?php
if(isset($_POST[‘name’])){
$name = $_POST[‘name’];
if(!empty($name)){
$handle = fopen(‘names.txt’, ‘a’);
fwrite($handle, $name."\n");
fclose($handle);
}else{
echo ‘Please type a name.’;
}
}
?>
Name:[/php]
Also, test.php is the same file i am using.
Thanks in advance!