Hello,
I had a form that has radio boxes. They allow the user the ability to say they want to hide or show the global header on the site. So show = 1 hide = 2
on the post page I have a function that I had hoped would open the file, loop through until the line equals what I am looking for and I could change it. Right now I am just trying to get it to echo the line once it finds it and I am getting errors.
Here is what I have.
//if they want to show the header we enter here
if ($_POST["header"] == 1)
{
function Show_Hide_Header($userid, $action)
{
//open file and setup the handle with read write permissions
$fh = fopen("../css/default.css", "r+");
while (!feof($fh))
{
//if we find the line we want, let's echo it for now
if (trim(fgets($fh, 1024)) == 'div.glblheader {')
echo fgets($fh, 1024);
}
}
//call my function and pass in the userid and action
Show_Hide_Header(1, 1);
}
As of now when I hit submit I get an error :
Warning: fopen(../css/default.css): failed to open stream: HTTP wrapper does not support writeable connections. in /home/photogap/public_html/accounts/control_panel.php on line 10
Now if I change the r+ in the fopen() to "r" so it is just read permissions, then nothing happens. It still does not echo the line.
ultimately I just want to find the line in my css file for globalheader and then change the very next line if it is "Visibility:hidden" change to "visible" and close the file.
Any help with this would be great. Thanks ahead of time