MichaelMackey Posted July 10, 2008 Share Posted July 10, 2008 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 https://forums.phpfreaks.com/topic/114086-solved-methodpost-it-doesnt-want-to-go-away/ Share on other sites More sharing options...
trq Posted July 10, 2008 Share Posted July 10, 2008 Is there something obvious I'm missing here? Code would help. Link to comment https://forums.phpfreaks.com/topic/114086-solved-methodpost-it-doesnt-want-to-go-away/#findComment-586381 Share on other sites More sharing options...
discomatt Posted July 10, 2008 Share Posted July 10, 2008 method="GET" Link to comment https://forums.phpfreaks.com/topic/114086-solved-methodpost-it-doesnt-want-to-go-away/#findComment-586386 Share on other sites More sharing options...
kenrbnsn Posted July 10, 2008 Share Posted July 10, 2008 Why do you want to change from POST to GET? Ken Link to comment https://forums.phpfreaks.com/topic/114086-solved-methodpost-it-doesnt-want-to-go-away/#findComment-586391 Share on other sites More sharing options...
MichaelMackey Posted July 10, 2008 Author Share Posted July 10, 2008 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 https://forums.phpfreaks.com/topic/114086-solved-methodpost-it-doesnt-want-to-go-away/#findComment-586400 Share on other sites More sharing options...
MichaelMackey Posted July 10, 2008 Author Share Posted July 10, 2008 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 https://forums.phpfreaks.com/topic/114086-solved-methodpost-it-doesnt-want-to-go-away/#findComment-586406 Share on other sites More sharing options...
MichaelMackey Posted July 10, 2008 Author Share Posted July 10, 2008 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 https://forums.phpfreaks.com/topic/114086-solved-methodpost-it-doesnt-want-to-go-away/#findComment-586411 Share on other sites More sharing options...
discomatt Posted July 10, 2008 Share Posted July 10, 2008 Is this your own code or someone else's? If you're having problems understanding what's going on, it's very difficult for us to help you. Link to comment https://forums.phpfreaks.com/topic/114086-solved-methodpost-it-doesnt-want-to-go-away/#findComment-586424 Share on other sites More sharing options...
MichaelMackey Posted July 10, 2008 Author Share Posted July 10, 2008 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 https://forums.phpfreaks.com/topic/114086-solved-methodpost-it-doesnt-want-to-go-away/#findComment-586427 Share on other sites More sharing options...
discomatt Posted July 10, 2008 Share Posted July 10, 2008 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 https://forums.phpfreaks.com/topic/114086-solved-methodpost-it-doesnt-want-to-go-away/#findComment-586430 Share on other sites More sharing options...
MichaelMackey Posted July 10, 2008 Author Share Posted July 10, 2008 Ah i see, I've been doing this the hard way. I didn't realize the GET method could just be set to replace the POST method, I've been manually assigning the GET variables through the URL. Link to comment https://forums.phpfreaks.com/topic/114086-solved-methodpost-it-doesnt-want-to-go-away/#findComment-586440 Share on other sites More sharing options...
MichaelMackey Posted July 10, 2008 Author Share Posted July 10, 2008 Ah there I go, with the pages being set up automatically having a single GET feature stuck to them it was confusing the program when I tried to add more. I got it working now, thanks for the help guys. Link to comment https://forums.phpfreaks.com/topic/114086-solved-methodpost-it-doesnt-want-to-go-away/#findComment-586445 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.