Jump to content

[SOLVED] Method=Post, it doesn't want to go away....


MichaelMackey

Recommended Posts

So I've been recently trying to remove POST requirements on some of the pages in the site Im working on.  I've managed to remove most of the requirement now, but when I try and remove method=post from the form variables, the page sends me to the

 

ad_index.php?

 

instead of

 

ad_index.php?kn_mod=resultslist

 

after a submit, as it does when method=post is there.  Is there something obvious I'm missing here? Thanks.

Link to comment
Share on other sites

Why do you want to change from POST to GET?

 

Ken

 

The page I'm using has many lists and has to be referred back to regularly, with POST it was constantly giving the POST reload warning.

 

Sorry if this was a little vague I'm new to PHP and working with a previously set up system, it's a lot to take in:)

Link to comment
Share on other sites

Hmm, also the GET doesn't seem to work....

 

It still sends me back to the index? page.  I could post all the code if needed but I don't think it would help too much for this issue.  Right now if I had to guess I would say it isn't referencing the action change for the page correctly from the javascript when no POST method is there.  Why does it do that?  No idea :(

Link to comment
Share on other sites

This is the form itself

 

      echo '<form name="formDDL" id="formDDL" method="get">';
      //This was added in to make the lists easier to read, alternating row colour
      $count = 0;

      while(($displaystuff = mysql_fetch_array($results)) && $rowCount <= ($currentPage * 50))
      {
      if($rowCount > (($currentPage -1) * 50)){  //Paging

      if ($count == 0){echo '<tr bgcolor="#f9f9f9">'; $count = $count + 1;}
      else {echo '<tr>'; $count = 0;}
      //To add in the middlename here just add $displaystuff[1]
      //It was removed by Michael Mackey June 2 2008 to make more room on the page.
      //June 3 added in wordwrap function instead of substring
      $tmpname = wordwrap($displaystuff[0]." ".$displaystuff[2], 23, "<br />\n");

        if(!empty($displaystuff['email2'])) {$emailadr = $displaystuff['email1']."; ".$displaystuff['email2']; }
        else {$emailadr = $displaystuff['email1'];}

        echo '<td> <input id="email" type="checkbox" value="'."$emailadr".'"/></td>';
echo '<td><a href="ad_index.php?kn_mod=edit_contresults&id='.$displaystuff[5].$gradevalue.'">';
echo '<img src="./images/b_edit.png" border="0" align="left" alt="Edit">';
echo '</a></td>';


      echo "<td>$serialnum</td>";
      echo "<td>$tmpname</td>";
      echo "<td style='text-align:center;'>$displaystuff[3]</td>"; // grade

      $sadress = wordwrap($displaystuff[4], 23, "<br />\n");
      echo "<td>$sadress</td>";
      echo "<td>$displaystuff[6]</td>";
      //echo "<td>$displaystuff[6]</td>"; // city
      echo (isset($displaystuff[7]) ? "<td style='text-align:center;'>$displaystuff[7]</td>" : "<td style='text-align:center;'>-</td>"); // score
      //Added in June 2 2008 by Michael Mackey in order to show the contestant awards in the listing
      $awards = wordwrap($displaystuff[recognition], 23, "<br />\n");

      echo "<td>$awards</td>";

      echo '</tr>';
          }
          $serialnum++;
          $rowCount++; //Paging
      }

      echo '</form></table>';

 

This is the javascript that changes the action method of the form before submitting it

 

function newGetValue(newValue, getType){
        document.getElementById(getType).value = newValue;
        //This assigns the url
        var thisURL = document.getElementById('urlLink').value;
        //This creates the get string based on the page
        if(thisURL = 'ad_index.php?kn_mod=resultslist'){
               var thisYear = document.getElementById('getYear').value;
               var thisCity = document.getElementById('getCity').value;
               var thisGrade = document.getElementById('getGrade').value;
               var thisScore = document.getElementById('getScore').value;
               var thisType = document.getElementById('getType').value;
               var thisAward = document.getElementById('getAward').value;
               var thisPage = document.getElementById('getPage').value;
               var thisEmail = document.getElementById('getEmail').value;
               var thisOrder = document.getElementById('getOrder').value;
               document.formDDL.action = thisURL + '&year=' + thisYear + '&city=' + thisCity + '&grade=' + thisGrade + '&score=' + thisScore + '&type=' + thisType + '&award=' + thisAward + '&page=' + thisPage + '&email=' + thisEmail + '&order=' + thisOrder;
               document.formDDL.submit();
        }
}

Link to comment
Share on other sites

It's my code and two other peoples.  I understand how everything here works, I just don't understand some features of PHP/HTML.  For instance my other forms simply submit fine even if they don't have a method listed, I dont know why this one sends me to the index.

 

Edit: I could post the full code if you'd like.

Link to comment
Share on other sites

Submitting is on the client side. PHP checks for POST or GET and completes its actions as necessary. If the attribute isn't present in the markup, it's up to the browser to decide... the browser HAS to send a method along with the data, or the server has no idea what it's getting.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.