Posted by Jerry Stuckle on 07/22/05 00:29
Shelly wrote:
> "Ken Robinson" <kenrbnsn@rbnsn.com> wrote in message
> news:1121918986.319055.207170@z14g2000cwz.googlegroups.com...
>
>>
>>Shelly wrote:
>>
>>>I am a little puzzled by the sequence of events. Please help me out.
>>>
>>>I have page a.php. There is a button of type "submit" and name
>>>"submit". I do an
>>>
>>>if (isset($_POST['submit'])) {....}
>>>
>>>I enter the braces. Inside the braces I have a
>>>
>>>header("Location: b.php");
>>>
>>>Now here is the thing. What happens is that the a.php seems to get
>>>reexecuted, and since it now fails on a fopen in a.php, the thing never
>>>gets
>>
>>Can you post your code or enough of the code so we can see the problem.
>>Without seeing the program flow, it is hard to determine where the
>>problem lies.
>>
>>Ken
>>
>
>
> <?php
> require_once('Connections/ssLogin.php');
> session_start();
> $list_start = $_GET['liststart'];
> $i = $_GET['row'];
> $dbVal = $_SESSION['mail_list'];
> $from = $dbVal[$i]['sender'];
> $subj = $dbVal[$i]['subject'];
> $filename = $dbVal[$i]['filename'] . ".txt";
> $message = file_get_contents("mail_files/" . $filename);
> if (isset($_POST['submit'])) {
> if ($_POST['submit'] == "Reply"){
> $from = $_POST['SendTo'];
> $sendto = $_POST['From'];
> $subject = "Re: " . $_POST['Subject'];
> } else if ($_POST['submit'] == "Delete"){
> } else if ($_POST['submit'] == "Cancel"){
> }
> header("Location: ssListMail.php?liststart=" . $list_start_point); .
> ====
> html stuff with:
> <input type="submit" name="submit" value="Cancel">
>
> When I click the "Cancel" button, it tries to re-execute the page and gives
> me:
>
> Warning: file_get_contents(mail_files/.txt): failed to open stream: No such
> file or directory in /home/virtual/site23/fst/var/www/html/ssReadMail.php on
> line 10
>
> The first time in it read the filename and put the result in $message. My
> question is why is it running the page on submit rather than going to
> ssListMail.php.
>
> Shelly
>
>
Call exit() after your header() call. Otherwise all you do is set the header
and continue processing.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|