Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/240104-coding-error-with-form-sending/
Share on other sites

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"
?>

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.

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.