Stupid php submit form question
Closed this issue · 0 comments
stevel4857 commented
I tried to simply add submit code to the a-form and it doesn't communicate like a standard form.
I do have php reading in a text file. http://www.cablecenter.org/vr/aframe-material-master/
The text reads, "MY TEXT FILE" but I want the form to write to the text file like a standard php form would. Is this possible? This is the code I used in simple html:
`<?php
if(isset($_POST['submit']))
{
$name = $_POST['name'];
$age = $_POST['age'];
$comment = $_POST['comment'];
$file = fopen("test.txt","w+") or die("file not open"); // create and open text file
$s = $name."
".$age."
".$comment."
";fputs($file,$s) or die("data not write"); // write single line to file
fclose($file); // close file
}
?>
Data Form
Name:age:
Comment: <textarea name="comment" rows="5" cols="40"></textarea>
Whats written in the text file:
`