|
Posted by Shelly on 07/21/05 14:31
I moved the file_get_contents() to after the if(isset( stuff and now it
goes where it should. However, why is is reexecuted? Is ir automatic so
that it will then "see" the if(isset( code? It isn't stored anywhere? I
guess that makes sense. What I will do from now on is handle things that
way. So, it re=executes without passing parameters. Thnat is why the
hidden variables are needed if they are needed in the if(isset( submit
testing.
Shelly
"Shelly" <sheldonlg.news@asap-consult.com> wrote in message
news:9PSdnb9-LLYiGELfRVn-vA@comcast.com...
>
> "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
>
Navigation:
[Reply to this message]
|