I'm getting close with this.... changing strings in a php file through a form.
I use the file below to change the php string $goalie = "brown" to
$goalie= "whatever"
through a form and, thanks to Grumbler and others, it works quite well. Now I'm wondering about the session script (I'm a newbie). The change lasts for the session but not when the user revisits later. Is there any way I can get the change to be permanent until the user decides at some time in the future to change the goalie variable yet again.
Am trying to do everything on the page because I don't have a MYSQL database which I should imagine would help. This is the script I am testing... hope someone can help:
<?php
session_start();
?>
<BODY>
<FORM NAME="WHATEVERYOUWANT" METHOD="POST">
<input type="text" name="goalie">
<BR>
<input type="submit" name="submitbutton" value="change my string"></form>
<?php
if (!isset($goalie)) // if "goalie" wasn't clicked
$_POST['goalie'] = "browntest"; // or whatever you want the default to be
session_start();
if(isset($SESSION['goalie'])) // We have a goalie.
$goalie=$SESSION['goalie'];
if(isset($POST['goalie'])) // We're changing the goalie
{ $goalie = $POST['goalie'];
$SESSION['goalie'] = $POST['goalie'];
}
?>
<?php
echo $goalie;
?>
</BODY>