Jump to content

How to Update a php page using a form


paddymull

Recommended Posts

Hi all, Right just to let you all know am new to php,

 

what I want to do let my customers change one of there php page's within an admin area.

 

for example lets say they have a page with lets say welcome text on it, i wont hem to be able to go to an admin area and update it. so there would be a text area with the welcome text already in it, and if they change it and click save then this will update on there php page and will be able to be seen if the url is typed in.

 

I suppose its a bit of content management i want them to be able to do.

 

what i have managed to do is create a php file that has a text area in it and i can get it to send the text i put into it to another php page, but this isn't saved on the page as if you cross it off and go back on it the info i added is no longer there.

 

here's an example of what i have done

 

http://onlineframedpictures.co.uk/example/example.php

 

it then updates this page

 

http://onlineframedpictures.co.uk/example/example1.php

 

but like i said it doesn't save, how can i get it to save?? do i need to use my sql database?? if so how do i do this???

 

below is the code used in the example.php file

 

<form name="example1" action="example1.php" method="POST" target="_blank">	

<textarea cols=68 rows=27 name="message"></textarea>

<input type="submit" value=" save ">

 

and here is the code used in example1.php

 

<?php


/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
$message = $HTTP_POST_VARS['message'];
//magic quotes fix
$message= (get_magic_quotes_gpc())?stripslashes($message):$message;
?>

<P><FONT face=Arial color=#333333 size=2><?php echo $message ?></FONT></P>

 

how can i do this so it changes the page permanently

 

thanks in advance

Patrick

 

 

Link to comment
https://forums.phpfreaks.com/topic/142213-how-to-update-a-php-page-using-a-form/
Share on other sites

You would need to use a database or use flat files if you want to use database (which is a better option) the first thing you would need is a database then to know how to connect to it I have some basic tutorials the first one starts with connecting to a database have a look may be useful http://www.newmedia.lincoln.ac.uk/dcarr/tutorials/php/p-6

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.