| |||||||||||
| |||||||||||
Using a Form to write variables to a php page Posted by crazyjake (crazyjake), 9 March 2004 Hi,I have a php file called: 1.php which contains: <? include("config.php"); print "the title are <B>$page_title</B> and my name is <B>$my_name</B><BR>"; echo "my favorite quote <B>$my_quote</B> i dont forget my last name are <B>$my_lastname</B>"; ?> This will include the the config.php page and then the variables such as $page_title will be displayed on the page. The config.php file contains: <?php $page_title = "this is the page title"; $my_quote = "this is my quote"; $my_name = "this is my name"; $my_lastname = "this is my last name"; ?> So this is a list of variables that have some strings assigned to them. Now all i would like help with is a form that could read the variables and actually display them in textboxes, then the user could see what was originally in there and the user can easily edit them. Once the textboxes have been changed i would like a submit button that would submit the information in each textbox field back into the config.php page. Basically want a page that will allow me to change the variables in the config.php page. Please explain everything if you can as it will also help me learn. thanks very much for yout time and help guys. Jason Posted by admin (Graham Ellis), 10 March 2004 Hi, Jake ... welcome to the board. I'm out of the office this week and dialling in "International" so this is just a brief reply ... I think what you're looking for is something like "sticky boxes" - a regular PHP topic.I wrote an article on this is the Autumn, 2003 issue of our "Of Course" magazine, including a full source code listing. It's available for download from http://www.wellho.net/downloads Posted by crazyjake (crazyjake), 10 March 2004 Hi,I am actually a PHP n00b only started 3days back. I know hardly anything apart from what is going on in my script. I can easily follow mine. But the one in that PDF magazine/book was a bit weird its kinda an email form. I have no idea please help, I have explained as much as I can! Cheers Guys, thx for trying to help Graham but im a n00b hehe ![]() Posted by Chris_Isaac (Chris Isaac), 11 March 2004 HiThe form below should do what you want, but by no means is it elegant, and I'm sure theres a better way of doing it, also it doesn't look at any security with regard to possible millicious/accidental data entered into the form, but it works ![]() Code:
Hope this helps. Posted by crazyjake (crazyjake), 11 March 2004 Thanks loads!Looks really good! I am thinking of using it as a control panel for my site to easily edit content. Thats the script for each page and I have CHMODED the correct file, but once i submit to the file once, i try to submit again and I need it to update over the old variables is this possible? Quote:
Quote:
Quote:
Posted by Chris_Isaac (Chris Isaac), 11 March 2004 I'm not sure I completely understand what your trying to do, are you saying you needed to update several different files with data from the form? or do you wish to just keep updating (in this case) the file called myvaribles.php4If its the latter, just reenter the new data if your still on the page, or reload it, it will bring in the latest varibles for you to overwrite as before. Posted by crazyjake (crazyjake), 11 March 2004 yeh cheers m8!I was overriding a file that the form needed, solved it now cheers! ![]() works well good This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |