Jump to content

jasonv1981

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jasonv1981's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Is that because I am using echo? What would I use to actually write the code to the file I am attempting to edit? Like CURL or setting an array prior to sending the header? Thanks for your response.
  2. Hello, I am new to some of the rules to PHP as far as what you can POST or SEND via forms in PHP. I am attempting to change the location of a page via the header() function and basically redirect to another page if the weather is inclimate at an outdoor events center. Currently what I have is two different submit buttons that would post the header() redirect based on if the weather is good or bad. Ex. <div style="width:220px; height:50px;"> <form method="POST" action="../../weather.php"> <input type="submit" value="Good Weather" name="weather_good" /> <input type="submit" value="Bad Weather" name="weather_bad" /> </form> </div> Then the processing for the form is this file - <?php if(isset($_POST['weather_good'])){ $myFile = "../myfile.php"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = echo "<?php header ('Location:fall_festival/index.php'); ?>"; fwrite($fh, $stringData); fclose($fh); echo "Page Updated"; } else if(isset($_POST['weather_bad'])){ $myFile = "../myfile.php"; $fh = fopen($myFile, 'w') or die("can't open file"); $link = "header('Location:fall_festival/weather/index.php');" ; $stringData = $link; fwrite($fh, $stringData); fclose($fh); echo "Page Updated"; } ?> The file doesn't return an error when it's processed but it also doesn't update the file header and redirect to the proper page. Thanks for your time and help!
×
×
  • 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.