I'm sorry, I don't know what you mean. Please remember I'm a newbie to php. All I want my little script to do is take form data, write it to a text file, (it does this successfully now), then send the user to a different page or even rewrite the entire page with a little message telling them that the update was successful. It seems like it should be such a common thing to do. Can this be done with one click of the submit button? Thanks in advance.
This is my entire code (minus domains)...
<html>
<head></head>
<body>
<?php
// read file into array
$array = file('../db/data.txt');
?>
<center><b>UPDATE CURRENT SHOW INFORMATION!</b> </center>
<hr>
<p>
<form name="input" method="post"
action="<?php echo $_SERVER['SCRIPT_NAME']?>">
</p><label for="date"><b>Movies and Times Showing for the Week Of:</b> </label>
<input type="text" size="60" name="weekDate" id="weekDate" value="<?php echo $array[0];?> ">
<br><br>
<hr>
<table>
<tr><td bgcolor="#99CCFF">
<center><h2>MOVIE 1</h2></center><br>
<p><label for="title-1"><b>Title:</b> </label>
<input type="text" size="60" name="title-1" id="title-1" value="<?php echo $array[1];?>"/>
<label for="rating-1"><b>Rating:</b> </label>
<input type="text" size="15" name="rating-1" id="rating-1" value="<?php echo $array[2];?>"/></p>
<p><label for="actors-1"><b>Main Actors:</b> </label>
<input type="text" size="70" name="actors-1" id="actors-1" value="<?php echo $array[3];?>"/></p>
<p><label for="image-1":><b>Name of Image:</b> </label>
<input type="text" size="70" name="image-1" id="image-1" value="<?php echo $array[4];?>"/></p>
<p><label for="imageLink-1"><b>Link to Image Trailer:</b> </label>
<input type="text" size="150" name="imageLink-1" id="imageLink-1" value="<?php echo $array[5];?>"/></p>
<p><b>Movie 1 Description:</b><br>
<textarea rows="10" cols="80" name="description-1"><?php echo $array[6];?></textarea></p>
<table>
<tr><td colspan="7" align="center"><b>Showtimes</b></td></tr>
<tr >
<td align="center">Friday</td>
<td align="center">Saturday</td>
<td align="center">Sunday</td>
<td align="center">Monday</td>
<td align="center">Tuesday</td>
<td align="center">Wednesday</td>
<td align="center" >Thursday</td>
</tr>
<tr>
<td ><input type="text" size="20" name="fri-1" id="fri-1" value="<?php echo $array[7];?>"/></td>
<td><input type="text" size="20" name="sat-1" id="sat-1" value="<?php echo $array[8];?>"/></td>
<td><input type="text" size="20" name="sun-1" id="sun-1" value="<?php echo $array[9];?>"/></td>
<td><input type="text" size="20" name="mon-1" id="mon-1" value="<?php echo $array[10];?>"/></td>
<td><input type="text" size="20" name="tues-1" id="tues-1" value="<?php echo $array[11];?>"/></td>
<td><input type="text" size="20" name="wed-1" id="wed-1" value="<?php echo $array[12];?>"/></td>
<td><input type="text" size="20" name="thur-1" id="thur-1" value="<?php echo $array[13];?>"/></td>
</tr>
</table>
</p>
<br>
</td></tr>
</table>
</p>
<br>
</td></tr>
<tr><td>
<input type="submit" name="submit" value="Save Changes" /></p>
</form>
</td></tr>
</table>
<!--On submit, write to file-->
<?php
if (isset($_POST['submit'])) {
$weekDate = $_POST['weekDate'];
$title1 = $_POST['title-1'];
$rating1 = $_POST['rating-1'];
//$title1 = "\$title-1=\"" . $title1 . '";';
$actors1 = $_POST['actors-1'];
$image1 = $_POST['image-1'];
$imageLink1 = $_POST['imageLink-1'];
$description1 = $_POST['description-1'];
//remove \n
$description1 = str_replace("\n", "", $description1);
$fri1 = $_POST['fri-1'];
$sat1 = $_POST['sat-1'];
$sun1 = $_POST['sun-1'];
$mon1 = $_POST['mon-1'];
$tues1 = $_POST['tues-1'];
$wed1 = $_POST['wed-1'];
$thur1 = $_POST['thur-1'];
$fp = fopen("../db/data.txt","w");
if(!$fp) {
echo 'Error, the file could not be opened or there was an error creating it.';
exit;
}
fwrite($fp, $weekDate."\n" . $title1."\n" . $rating1."\n" . $actors1 . "\n" . $image1. "\n" . $imageLink1. "\n" . $description1. "\n" . $fri1. "\n" . $sat1. "\n" . $sun1. "\n" . $mon1. "\n" . $tues1. "\n" . $wed1. "\n" . $thur1);
fclose($fp);
header( 'Location: http://www.mydomain/success.html' ) ; //generates error msg
//I want to send the user to a different page here but how???
}
?>
</html>