jackr1909 Posted June 22, 2011 Share Posted June 22, 2011 hi, i don't now why this script isn't working, i don't even see the 'not working' echo, please can you help me <code> <?php $redirect_page = "fail.php"; if(in_array($_GET['svalue'], array('Search', 'search')){ $redirect_page = "index.html"; } header("Location: " . $redirect_page); echo "not working" ?> </code> Send page form= <form action="send.php" method="get"> <input type="text" name="query" id="query" size="80" value="" action="suggest.php" columns="2" autocomplete="off" delay="1500"> <input type="hidden" name="a" value="1"> <br> <input type="submit" name="svalue" value="1"> <input type="submit" name="svalue" value="2"> </center> </form> any help would be great thanks a lot, Jack Quote Link to comment https://forums.phpfreaks.com/topic/240104-coding-error-with-form-sending/ Share on other sites More sharing options...
EmperorJazzy Posted June 22, 2011 Share Posted June 22, 2011 jackr1909; Add the following lines to your file and rerun. ini_set ("display_errors", "1"); error_reporting(E_ALL); Example: <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); $redirect_page = "fail.php"; if(in_array($_GET['svalue'], array('Search', 'search')){ $redirect_page = "index.html"; } header("Location: " . $redirect_page); echo "not working" ?> Quote Link to comment https://forums.phpfreaks.com/topic/240104-coding-error-with-form-sending/#findComment-1233290 Share on other sites More sharing options...
jackr1909 Posted June 22, 2011 Author Share Posted June 22, 2011 yes and the page was 100% blank again. its not a server side error because all other php files are working thanks for the help Quote Link to comment https://forums.phpfreaks.com/topic/240104-coding-error-with-form-sending/#findComment-1233295 Share on other sites More sharing options...
TeNDoLLA Posted June 22, 2011 Share Posted June 22, 2011 First of all your code is a mess: 1. You are using in_array() to look for values 'Search' and 'search' from the user posted form. And you have not defined values such as 'search' or 'Search' in the form fields. 2. Not sure if this is correct, form action send.php. Means you have to process the form data in send.php. 3. <input> field DOES NOT have parameters like: autocomplete OR delay OR action at all. Only form tag has action parameter. While debugging you might wanna comment out also those redirects, so you are able to see the errors what it outputs when sending the form if there is any. Quote Link to comment https://forums.phpfreaks.com/topic/240104-coding-error-with-form-sending/#findComment-1233303 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.