I'm trying to create a back end for a food truck whose menu constantly changes. I want to make a form that can update text on another page. I'm new to PHP. I think I need a way for the form to update html. So far I have the form made so it will submit the text but the text dosn't remain on the page after it's closed. Is this possible in PHP or do I need to use something else? Here is what I have so far.
kidinbed
0
Newbie Poster
Recommended Answers
Jump to PostYou won't be able to keep your changes if all you're doing is having PHP process a form and then display the results because you're not saving it anywhere.
Two solutions:
1. Have the PHP that processes your form and then writes the output to a file that …
Jump to PostCan only echo Ty's advice. If you're new to php, I get the inkling that you have limited knowledge of MySQL. Apologies if this is not the case. Therefore, for a simple menu replacement system, overwriting a file (e.g. menu.html) may be the way to go.
It may be …
Jump to PostYeah, if your text area has a name attribute as "formdata", then you store that as $formdatavariable as you are showing in your last post.
I see two problems though:
1. $pagevariable needs to be a string, so you need quotes:
$pagevariable = "finalpage.html";
And …
Jump to PostOK, first of all - $_POST
If you only have the one form field called 'formdata' this will be ok. Otherwise you'll need to access the applicable $_POST variable for each one.
I wouldn't use 'int':
file_put_contents(...,...); //should suffice.
If you're using just the filename, …
Jump to Postfile_put_contents() will create a file if one does not exist. Currently, if you send your form to the code in your last post, php will either create or overwrite a file called "finalpage.html" and fill it with the data from your form. So if you fill your form's text area …
All 28 Replies
TySkby
41
Junior Poster
diafol
kidinbed
0
Newbie Poster
TySkby
41
Junior Poster
diafol
kidinbed
0
Newbie Poster
TySkby
41
Junior Poster
diafol
kidinbed
0
Newbie Poster
TySkby
41
Junior Poster
kidinbed
0
Newbie Poster
TySkby
41
Junior Poster
kidinbed
0
Newbie Poster
TySkby
41
Junior Poster
kidinbed
0
Newbie Poster
TySkby
41
Junior Poster
kidinbed
0
Newbie Poster
TySkby
41
Junior Poster
kidinbed
0
Newbie Poster
TySkby
41
Junior Poster
kidinbed
0
Newbie Poster
TySkby
41
Junior Poster
kidinbed
0
Newbie Poster
kidinbed
0
Newbie Poster
TySkby
41
Junior Poster
kidinbed
0
Newbie Poster
TySkby
41
Junior Poster
kidinbed
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.