wowzuzz
wowzuzz

Reputation: 1388

Form submit response 301 or 302

I have a form on my site and every time I submit this form..I get a 301 perm, then a 302 redirect, then another 302 redirect. My data is not submitting because of these redirects. I'm having no luck finding these redirects. There is no .htaccess file that is causing this in the root of the directory.

Where do I look to get rid of the redirects? Any tips would be appreciative.

My developer tools on submit goes to 301, 302, 302.

Here is the start of my form.

<form action="index.php?view=ticket_submit" method="POST" name="QContact" runat="vdaemon">

When this submits I have a case statement look for ticket_submit. It's not even getting to ticket_submit because of the var_dump and exit methods. It just goes back to the root index.php file.

private function ProcessView($type){
    $ticket = new Ticket();
    $ticket->CurrentUser = $this->CurrentUser;
    $ticket->TicketUser = $this->CurrentUser;
    $ticket->setBlankTicketHTML();
    $title = 'New ROI';
    $prior_count = count($this->Containers);
    $_SESSION['vdaemon'] = '1';
    if($_SESSION['al'] == 't' && $type['view'] == ''){
        $type['view'] = 'summary';
    }

    switch($type['view']){
        case 'ticket_edit':
            $ticket->ticketid = (int)$this->Request['ticketid'];
            $ticket->TicketUser = array();
            $ticket->fillTicket();

            if(($this->CurrentUser['userid'] != $ticket->TicketUser['userid']) && ($_SESSION['al'] == 't' || $_SESSION['al'] == 'r')){

                $ticket->setViewTicketHTML();
                $title = "Error: You can only Edit items you have created.";
                $_SESSION['vdaemon'] = '0';
            } else {
                $ticket->setEditTicketHTML();
                $title = 'Edit ROI';
                $_SESSION['vdaemon'] = '1';
            }
            break;

        case 'ticket_submit':
            var_dump('test');
            exit();
            $ticket->ticketid = (int)$this->Request['ticketid'];
            $ticket->TicketUser['useremail'] = $this->Request['useremail'];
            $ticket->saveTicket(0);
            $_SESSION['vdaemon'] = '0';             
            if($_REQUEST['viewquick'] == 'quick'){$quick = 'ticket_quick_view';}else{$quick = 'ticket_filed';}
            if($_REQUEST['edit'] == 'yes') {
                echo 'works';
            }else {
                header("Location: ?view=".$quick."&ticketid=".$ticket->ticketid);
                echo 'workss';
            }   
            exit;
            break;

Upvotes: 3

Views: 3658

Answers (1)

wowzuzz
wowzuzz

Reputation: 1388

I ended up fixing it and this is what the cause was.

Three things needed to be fixed.

The first thing was that I needed to fix a reference to a vdaemon library. The path was all screwed up. After that I got rid of a header redirect in two places. One was in a separate folder and one was on my index.php which I totally missed (thought I checked it). It was doing 302 redirects because the headers were there but in different folders throughout the server and on the index.php.

Next time I'll know what to look for. Thanks for everyone's efforts here. :)

Make sure you look for this code first when dealing with these errors

header("Location: http://www.foo.com");

Upvotes: 1

Related Questions