Write string into a PHP file?

Basically, I wanna use my form to write a new value for an existing string and I don’t really know how to do it.

My file opis.php contains $opis = “blabla”; and I want to change the blabla to something else by using a form, I hope you guys will know what I mean.

Can anybody help?
Jakub

If you want the variable to stay permanent after changing you’ll have to save the value in a database. Then all you have to do is pass the form info through the php file and save it in the database

I don’t want the value to stay permanent and I also don’t wanna store anything into a database.

I wanna use file opis.php to store a various strings and edit them

If it’s not permanent then it’ll be simple:

[php]

<?php If (!isset($_POST['string'])) { $string = 'blabla'; } Else { $string = $_POST['string'] } Echo "Current Text: ".$string; ?> Enter New Text: [/php]

Just name this file.php and goto it. As for saving in a file I am unsure.

Actually I got it all wrong, I want the value to completely change in a FILE

I wanna do it in that way.

In my index.php at the top I wanna put some variables (eg. $dupa = “blabla”:wink:

Then I want a form, where I can enter a new value for $dupa and after clicking submit the variable will get overwritten with the one I entered myself

I hope you understand me now
Thanks in advance!

Well the form I used above will change the variable but you’ll have to work out howto make it re-write it completely as it will reset with new users.

Sponsor our Newsletter | Privacy Policy | Terms of Service