My php page has the HTML and PHP all on the same page.
For the HTML section, user data is inputted and posted to the PHP section.
</div>
</header>
<pre>
</pre>
<h1 style="font-family: 'Lucida Sans Typewriter'"> Note entry:</h1>
<form method="post">
<div>
<div style="margin-right:5px;">
<input type="text" class="fileName" name="fileName" id="fileName" size="35"
value="untitled">
<input type="text" name="noteData" id="notes" size="250">
<input type="Submit" name="Submit" value="Save">
</div>
</div>
</form>
As for the PHP section, I check to see if a POST has occured, then save file and filename to disk, yet this does not occur.
if($_POST){
$noteName = $_POST['fileName'];
$noteData = $_POST['notes'];
$notes = fopen('' + $noteName,"wb");
fwrite($notes,$noteData);
fclose($notes);
}
The errors thrown are here:
https://gyazo.com/99646e2705ed7ea927d27c67cddb87b4
Any suggestions? I need this finished soon and cannot for the life of me discover why this is deciding not to work.
Ankur Mishra :
You have to use names to get data using $_POST. And use . to concatenate words in php. So change the line as:\n\nif($_POST){\n $noteName = $_POST['fileName'];\n $noteData = $_POST['noteData'];\n $notes = fopen('' . $noteName,\"wb\");\n fwrite($notes,$noteData);\n fclose($notes);\n}\n",
2020-02-23T17:15:08