jjmusicpro Posted October 5, 2007 Author Share Posted October 5, 2007 dont know whats going on now, it was working, now it wont work, i didnt change anything.... . <?php require_once ('connect.php'); require_once ('opendb.php'); $groupid_sent = $_GET['groupid']; $query = "SELECT * FROM metrogroups WHERE groupid='$groupid_sent'"; $result = @mysql_query ($query); $count = mysql_num_rows($result); //number of results while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $groupname = $row['groupname'] ; ?> <?php if($_SERVER['REQUEST_METHOD'] == "POST"){ $zipcode = $_POST['zipcode_entered_search']; $query2 = "INSERT INTO zipcodes_searched (zipcode,time_date) VALUES ('$zipcode', NOW())"; $result2 = mysql_query($query2); $query = "SELECT * FROM zipcodes WHERE zipcode='$zipcode' and on_off=1"; $result = @mysql_query ($query); $count = mysql_num_rows($result); if($count=="0"){ echo "<meta http-equiv=\"Refresh\" content=\"0;url=nf.php?groupid=" . $_GET['groupid'] . '?zipcode_entered_search=' . $_GET['zipcode_entered_search'] ."\">"; }else if($count=="1"){ while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $site = $row['redirect_url'] ; header("location:$site"); }}else{ while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ echo "<meta http-equiv=\"Refresh\" content=\"0;url=shared.php?groupid=" . $_GET['groupid'] . '?zipcode_entered_search=' . $_GET['zipcode_entered_search'] ."\">"; };}}else{}?> Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362955 Share on other sites More sharing options...
jjmusicpro Posted October 5, 2007 Author Share Posted October 5, 2007 ALl the process page should do is 3 things 1. if there is 0 results, go to page nf.php 2. if there is only 1 result, go to the url from db 3. if there is more then 1 result go to shared.php all that is happening is when i POST to process.php its a blank page. cant get it to work <?php if($_SERVER['REQUEST_METHOD'] == "POST"){ $zipcode = $_POST['zipcode_entered_search']; $query2 = "INSERT INTO zipcodes_searched (zipcode,time_date) VALUES ('$zipcode', NOW())"; $result2 = mysql_query($query2); $query = "SELECT * FROM zipcodes WHERE zipcode='$zipcode' and on_off=1"; $result = @mysql_query ($query); $count = mysql_num_rows($result); if($count=="0"){ echo "<meta http-equiv=\"Refresh\" content=\"0;url=nf.php?groupid=" . $_GET['groupid'] . '?zipcode_entered_search=' . $_GET['zipcode_entered_search'] ."\">"; }else if($count=="1"){ $site = $row['redirect_url'] ; echo("location:$site"); exit; }else{ echo "<meta http-equiv=\"Refresh\" content=\"0;url=shared.php?groupid=" . $_GET['groupid'] . '?zipcode_entered_search=' . $_GET['zipcode_entered_search'] ."\">"; }}else{}?> Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362960 Share on other sites More sharing options...
BlueSkyIS Posted October 5, 2007 Share Posted October 5, 2007 as far as i can tell the code you posted shouldn't even compile and should display an error like "unexpected end". do you have errors turned off? your braces don't match. It's MUCH easier to see if you indent your code: require_once ('connect.php'); require_once ('opendb.php'); $groupid_sent = $_GET['groupid']; $query = "SELECT * FROM metrogroups WHERE groupid='$groupid_sent'"; $result = @mysql_query ($query); $count = mysql_num_rows($result); //number of results while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $groupname = $row['groupname'] ; if($_SERVER['REQUEST_METHOD'] == "POST"){ $zipcode = $_POST['zipcode_entered_search']; $query2 = "INSERT INTO zipcodes_searched (zipcode,time_date) VALUES ('$zipcode', NOW())"; $result2 = mysql_query($query2); $query = "SELECT * FROM zipcodes WHERE zipcode='$zipcode' and on_off=1"; $result = @mysql_query ($query); $count = mysql_num_rows($result); if($count=="0"){ echo "<meta http-equiv=\"Refresh\" content=\"0;url=nf.php?groupid=" . $_GET['groupid'] . '?zipcode_entered_search=' . $_GET['zipcode_entered_search'] ."\">"; } else if($count=="1") { while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $site = $row['redirect_url'] ; header("location:$site"); } } else { while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ echo "<meta http-equiv=\"Refresh\" content=\"0;url=shared.php?groupid=" . $_GET['groupid'] . '?zipcode_entered_search=' . $_GET['zipcode_entered_search'] ."\">"; }; } } else {} // WHERE IS THE CLOSE OF THE while loop at the top?? also, you won't know if mysql_query() is the problem because you hide any errors. i'd change it to this: $result = mysql_query($query) or die(mysql_error()); add: if you don't know whether errors are turned on or off, add this to the top of your script: <?php ini_set('error_reporting', PHP_INI_ALL); ?> Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362964 Share on other sites More sharing options...
jjmusicpro Posted October 5, 2007 Author Share Posted October 5, 2007 still a blank page Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362966 Share on other sites More sharing options...
BlueSkyIS Posted October 5, 2007 Share Posted October 5, 2007 so you fixed the missing braces and added the or die(mysql_error()) to the code? Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362967 Share on other sites More sharing options...
jjmusicpro Posted October 5, 2007 Author Share Posted October 5, 2007 still a blank page when i put that at the top <?php ini_set('error_reporting', PHP_INI_ALL); ?> <?php require_once ('connect.php'); require_once ('opendb.php'); $groupid_sent = $_GET['groupid']; $query = "SELECT * FROM metrogroups WHERE groupid='$groupid_sent'"; $result = @mysql_query ($query); $count = mysql_num_rows($result); //number of results while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $groupname = $row['groupname'] ; if($_SERVER['REQUEST_METHOD'] == "POST"){ $zipcode = $_POST['zipcode_entered_search']; $query2 = "INSERT INTO zipcodes_searched (zipcode,time_date) VALUES ('$zipcode', NOW())"; $result2 = mysql_query($query2); $query = "SELECT * FROM zipcodes WHERE zipcode='$zipcode' and on_off=1"; $result = @mysql_query ($query); $count = mysql_num_rows($result); if($count=="0"){ echo "<meta http-equiv=\"Refresh\" content=\"0;url=nf.php?groupid=" . $_GET['groupid'] . '?zipcode_entered_search=' . $_GET['zipcode_entered_search'] ."\">"; } else if($count=="1") { while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $site = $row['redirect_url'] ; header("location:$site"); } } else { while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ echo "<meta http-equiv=\"Refresh\" content=\"0;url=shared.php?groupid=" . $_GET['groupid'] . '?zipcode_entered_search=' . $_GET['zipcode_entered_search'] ."\">"; }; } } else {} ?> Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362968 Share on other sites More sharing options...
BlueSkyIS Posted October 5, 2007 Share Posted October 5, 2007 this should have your braces matched and unnecessary loops removed: <?php require_once ('connect.php'); require_once ('opendb.php'); $groupid_sent = $_GET['groupid']; $query = "SELECT * FROM metrogroups WHERE groupid='$groupid_sent'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); $groupname = $row['groupname'] ; if($_SERVER['REQUEST_METHOD'] == "POST") { $zipcode = $_POST['zipcode_entered_search']; $query2 = "INSERT INTO zipcodes_searched (zipcode,time_date) VALUES ('$zipcode', NOW())"; $result2 = mysql_query($query2); $query = "SELECT * FROM zipcodes WHERE zipcode='$zipcode' and on_off=1"; $result = mysql_query($query) or die(mysql_error()); $count = mysql_num_rows($result); if($count=="0"){ header( "location: nf.php?groupid=" . $_GET['groupid'] . "?zipcode_entered_search=" . $_GET['zipcode_entered_search'] ."\">"); exit; } else if($count=="1") { $row = mysql_fetch_array($result, MYSQL_ASSOC); $site = $row['redirect_url'] ; header("location:$site"); exit; } else { $row = mysql_fetch_array($result, MYSQL_ASSOC); header( "location: shared.php?groupid=" . $_GET['groupid'] . '?zipcode_entered_search=' . $_GET['zipcode_entered_search'] ."\">"); exit; } } else { // No POST, so do whatever we do if there is no POST. } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362972 Share on other sites More sharing options...
jjmusicpro Posted October 5, 2007 Author Share Posted October 5, 2007 still a blank page Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362974 Share on other sites More sharing options...
jjmusicpro Posted October 5, 2007 Author Share Posted October 5, 2007 still blank page here is the form sending data to process.php <TD width="64%" height="47"><form action="process.php?groupid=<?php $groupid_sent = $_GET['groupid']; echo $groupid_sent ?>" method="POST"> <div align="center"> <input type="text" maxlength="10" class="searchBox" name="zipcode_entered_search" size="8" /> <input name="Submit" type="image" id="Submit" src="handyman_files/go_button.gif" alt="Request Service from your local Mr. Handyman!"> </div> </form></TD> here is complete process.php <?php ini_set('error_reporting', PHP_INI_ALL); ?> <?php require_once ('connect.php'); require_once ('opendb.php'); $groupid_sent = $_GET['groupid']; $query = "SELECT * FROM metrogroups WHERE groupid='$groupid_sent'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); $groupname = $row['groupname'] ; if($_SERVER['REQUEST_METHOD'] == "POST") { $zipcode = $_POST['zipcode_entered_search']; $query2 = "INSERT INTO zipcodes_searched (zipcode,time_date) VALUES ('$zipcode', NOW())"; $result2 = mysql_query($query2); $query = "SELECT * FROM zipcodes WHERE zipcode='$zipcode' and on_off=1"; $result = mysql_query($query) or die(mysql_error()); $count = mysql_num_rows($result); if($count=="0"){ header( "location: nf.php?groupid=" . $_GET['groupid'] . "?zipcode_entered_search=" . $_GET['zipcode_entered_search'] ."\">"); exit; } else if($count=="1") { $row = mysql_fetch_array($result, MYSQL_ASSOC); $site = $row['redirect_url'] ; header("location:$site"); exit; } else { $row = mysql_fetch_array($result, MYSQL_ASSOC); header( "location: shared.php?groupid=" . $_GET['groupid'] . '?zipcode_entered_search=' . $_GET['zipcode_entered_search'] ."\">"); exit; } } else { // No POST, so do whatever we do if there is no POST. } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362975 Share on other sites More sharing options...
MadTechie Posted October 5, 2007 Share Posted October 5, 2007 try this <TD width="64%" height="47"><form action="process.php?groupid=<?php echo $_GET['groupid'];?>" method="POST"> <div align="center"> <input type="text" maxlength="10" class="searchBox" name="zipcode_entered_search" size="8" /> <input name="Submit" type="image" id="Submit" src="handyman_files/go_button.gif" alt="Request Service from your local Mr. Handyman!"> </div> </form></TD> <?php error_reporting(E_ALL); require_once ('connect.php'); require_once ('opendb.php'); $groupid_sent = (int)$_GET['groupid']; $query = "SELECT * FROM metrogroups WHERE groupid=$groupid_sent"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); $groupname = $row['groupname'] ; if( isset($_POST['Submit']) ) { $zipcode = $_POST['zipcode_entered_search']; $query2 = "INSERT INTO zipcodes_searched (zipcode,time_date) VALUES ('$zipcode', NOW())"; $result2 = mysql_query($query2); $query = "SELECT * FROM zipcodes WHERE zipcode='$zipcode' and on_off=1"; $result = mysql_query($query) or die(mysql_error()); $count = mysql_num_rows($result); switch($count) { case 0: header( "location: nf.php?groupid=" . $_GET['groupid'] . "?zipcode_entered_search=" . $_GET['zipcode_entered_search'] ."\">"); exit; break; case 1: $row = mysql_fetch_array($result, MYSQL_ASSOC); $site = $row['redirect_url'] ; header("location: $site"); exit; break; default: $row = mysql_fetch_array($result, MYSQL_ASSOC); header( "location: shared.php?groupid=" . $_GET['groupid'] . '?zipcode_entered_search=' . $_GET['zipcode_entered_search'] ."\">"); exit; break; } } else { echo "Nothing submitted!"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362979 Share on other sites More sharing options...
jjmusicpro Posted October 5, 2007 Author Share Posted October 5, 2007 ran you code and it says "nothing submitted"... Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362982 Share on other sites More sharing options...
MadTechie Posted October 5, 2007 Share Posted October 5, 2007 humm change the form code to <TD width="64%" height="47"><form action="process.php?groupid=<?php echo $_GET['groupid'];?>" method="POST"> <div align="center"> <input type="text" maxlength="10" class="searchBox" name="zipcode_entered_search" size="8" /> <input name="Submit" type="image" src="handyman_files/go_button.gif" alt="Request Service from your local Mr. Handyman!"> </div> </form></TD> also i assume the php code is in a the called process.php Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362985 Share on other sites More sharing options...
jjmusicpro Posted October 5, 2007 Author Share Posted October 5, 2007 yep... still blank page... this is my old code, all works fine, but want it to be faster with the header() calls... <?php if($_SERVER['REQUEST_METHOD'] == "POST"){ require_once ('connect.php'); require_once ('opendb.php'); $groupid_sent = $_GET['groupid']; $query = "SELECT * FROM metrogroups WHERE groupid='$groupid_sent'"; $result = @mysql_query ($query); $count = mysql_num_rows($result); //number of results while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $groupname = $row['groupname'] ; } }else{ require_once ('connect.php'); require_once ('opendb.php'); $groupid_sent = $_GET['groupid']; $query = "SELECT * FROM metrogroups WHERE groupid='$groupid_sent'"; $result = @mysql_query ($query); $count = mysql_num_rows($result); //number of results while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $groupname = $row['groupname'] ; } } ?> <?php if($_SERVER['REQUEST_METHOD'] == "POST"){ $zipcode = $_POST['zipcode_entered_search']; $query2 = "INSERT INTO zipcodes_searched (zipcode,time_date) VALUES ('$zipcode', NOW())"; $result2 = mysql_query($query2); $query = "SELECT * FROM zipcodes WHERE zipcode='$zipcode' and on_off=1"; $result = @mysql_query ($query); $count = mysql_num_rows($result); if($count=="0"){ echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=nf.php\">"; exit; }else if($count=="1"){ while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $site = $row['redirect_url'] ; echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=$site\">"; } }else{ echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=shared.php\">"; } }else{ } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362988 Share on other sites More sharing options...
MadTechie Posted October 5, 2007 Share Posted October 5, 2007 i assume the php code is in a the called process.php, is this correct and are you clicking on the submit (go button) ? aso for your old code why now just change echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=$site\">"; to Header("location: $site"); ?? Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362990 Share on other sites More sharing options...
jjmusicpro Posted October 5, 2007 Author Share Posted October 5, 2007 if i change any of those lines to the header function like you said, i get a blank page <?php if($_SERVER['REQUEST_METHOD'] == "POST"){ require_once ('connect.php'); require_once ('opendb.php'); $groupid_sent = $_GET['groupid']; $query = "SELECT * FROM metrogroups WHERE groupid='$groupid_sent'"; $result = @mysql_query ($query); $count = mysql_num_rows($result); //number of results while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $groupname = $row['groupname'] ; } }else{ require_once ('connect.php'); require_once ('opendb.php'); $groupid_sent = $_GET['groupid']; $query = "SELECT * FROM metrogroups WHERE groupid='$groupid_sent'"; $result = @mysql_query ($query); $count = mysql_num_rows($result); //number of results while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $groupname = $row['groupname'] ; } } ?> <?php if($_SERVER['REQUEST_METHOD'] == "POST"){ $zipcode = $_POST['zipcode_entered_search']; $query2 = "INSERT INTO zipcodes_searched (zipcode,time_date) VALUES ('$zipcode', NOW())"; $result2 = mysql_query($query2); $query = "SELECT * FROM zipcodes WHERE zipcode='$zipcode' and on_off=1"; $result = @mysql_query ($query); $count = mysql_num_rows($result); if($count=="0"){ echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=nf.php\">"; exit; }else if($count=="1"){ while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $site = $row['redirect_url'] ; echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=$site\">"; } }else{ echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=shared.php\">"; } }else{ } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362991 Share on other sites More sharing options...
MadTechie Posted October 5, 2007 Share Posted October 5, 2007 erm.. thats code has no headers!! also you said that code worked! Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362995 Share on other sites More sharing options...
jjmusicpro Posted October 5, 2007 Author Share Posted October 5, 2007 yep the one above works but when i try to add in the headers() part, it dosent work. just blank page Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-362997 Share on other sites More sharing options...
jjmusicpro Posted October 5, 2007 Author Share Posted October 5, 2007 i just want to get thsi script here to kick out the results that match the zipcode entered i just need it to kick out this when it goes to the page, but cant seem to get rid of all those else if's }else{ echo "<p><b>Make sure you contact the office in your territory!</b><br /><br><table width=\"400\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\" valign=\"top\">"; while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ echo '<tr><td colspan=2 valign="middle">' . $row['company_name'] . '<br>' .$row['notes_1'] . '</b></td></tr><tr><td valign=top><img src=mm_smaller.gif></td><td>' .'<b>Phone:</b>'. ' ' . $row['phone_number'] . '<br>'.'<a href="'. $row['redirect_url'] . '"> Visit Website </a>'. ' ' .'</td></tr>'; }echo '</table>'; <?php if($_SERVER['REQUEST_METHOD'] == "POST"){ $zipcode = $_POST['zipcode_entered_search']; $query2 = "INSERT INTO zipcodes_searched (zipcode,time_date) VALUES ('$zipcode', NOW())"; $result2 = mysql_query($query2); $query = "SELECT * FROM zipcodes WHERE zipcode='$zipcode' and on_off=1"; $result = @mysql_query ($query); $count = mysql_num_rows($result); if($count=="0"){ echo "<meta http-equiv=\"Refresh\" content=\"0;url=nf.php?groupid=" . $_GET['groupid'] . '?zipcode_entered_search=' . $_GET['zipcode_entered_search'] ."\">"; }else if($count=="1"){ while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $site = $row['redirect_url'] ; echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=$site\">"; } }else{ echo "<p><b>Make sure you contact the office in your territory!</b><br /><br><table width=\"400\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\" valign=\"top\">"; while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ echo '<tr><td colspan=2 valign="middle">' . $row['company_name'] . '<br>' .$row['notes_1'] . '</b></td></tr><tr><td valign=top><img src=mm_smaller.gif></td><td>' .'<b>Phone:</b>'. ' ' . $row['phone_number'] . '<br>'.'<a href="'. $row['redirect_url'] . '"> Visit Website </a>'. ' ' .'</td></tr>'; }echo '</table>'; } }else{ } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-363008 Share on other sites More sharing options...
jjmusicpro Posted October 5, 2007 Author Share Posted October 5, 2007 I wanted to take the zipcode_entered_searched thats being passed in the URL, and put that into the query, and kick out the results, by i cant get my syntax right <?php $zipcode = $_GET['zipcode_entered_search']; $query2 = "INSERT INTO zipcodes_searched (zipcode,time_date) VALUES ('$zipcode', NOW())"; $result2 = mysql_query($query2); $query = "SELECT * FROM zipcodes WHERE zipcode='$zipcode' and on_off=1"; $result = @mysql_query ($query); $count = mysql_num_rows($result); echo "<p><b>Make sure you contact the office in your territory!</b><br /><br><table width=\"400\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\" valign=\"top\">"; while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ echo '<tr><td colspan=2 valign="middle">' . $row['company_name'] . '<br>' .$row['notes_1'] . '</b></td></tr><tr><td valign=top><img src=mm_smaller.gif></td><td>' .'<b>Phone:</b>'. ' ' . $row['phone_number'] . '<br>'.'<a href="'. $row['redirect_url'] . '"> Visit Website </a>'. ' ' .'</td></tr>'; }echo '</table>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-363013 Share on other sites More sharing options...
MadTechie Posted October 6, 2007 Share Posted October 6, 2007 OK lets go back to this.. <TD width="64%" height="47"><form action="process.php?groupid=<?php echo $_GET['groupid'];?>" method="POST"> <div align="center"> <input type="text" maxlength="10" class="searchBox" name="zipcode_entered_search" size="8" /> <input name="Submit" type="image" src="handyman_files/go_button.gif" alt="Request Service from your local Mr. Handyman!"> </div> </form></TD> <?php error_reporting(E_ALL); require_once ('connect.php'); require_once ('opendb.php'); $groupid_sent = (int)$_GET['groupid']; $query = "SELECT * FROM metrogroups WHERE groupid=$groupid_sent"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); $groupname = $row['groupname'] ; if( isset($_POST['Submit']) ) { $zipcode = $_POST['zipcode_entered_search']; $query2 = "INSERT INTO zipcodes_searched (zipcode,time_date) VALUES ('$zipcode', NOW())"; $result2 = mysql_query($query2); $query = "SELECT * FROM zipcodes WHERE zipcode='$zipcode' and on_off=1"; $result = mysql_query($query) or die(mysql_error()); $count = mysql_num_rows($result); switch($count) { case 0: header( "location: nf.php?groupid=" . $_GET['groupid'] . "?zipcode_entered_search=" . $_GET['zipcode_entered_search']); echo "location: nf.php?groupid=" . $_GET['groupid'] . "?zipcode_entered_search=" . $_GET['zipcode_entered_search']); exit; break; case 1: $row = mysql_fetch_array($result, MYSQL_ASSOC); $site = $row['redirect_url'] ; header("location: $site"); echo "location: $site"; exit; break; default: $row = mysql_fetch_array($result, MYSQL_ASSOC); header( "location: shared.php?groupid=" . $_GET['groupid'] . '?zipcode_entered_search=' . $_GET['zipcode_entered_search']); echo "location: shared.php?groupid=" . $_GET['groupid'] . '?zipcode_entered_search=' . $_GET['zipcode_entered_search']; exit; break; } } else { echo "Nothing submitted!"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72012-making-a-redirect-faster-when-posting-to-same-page/page/2/#findComment-363243 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.