RAN RAN
RAN RAN

Reputation: 33

cant get the value when submitted

I have this in my form

<script>
    function changeLink(link) {
        parent.iframe_a2.location=link + "?find=" + find.value;
    }
</script>   


   <h2>Search</h2>     
   <form name="search" method="get" action="select1WSearch.php" target="iframe_a" 
     onsubmit="return changeLink('select2WSearch.php')">
   Seach for: <input type="text" name="find" /> in 
     <Select NAME="field">
       <Option VALUE="no">No</option>
       <Option VALUE="CPUname">CPUname</option>
     </Select>
     <input type="hidden" name="searching" value="yes" />
     <input type="submit" name="submit" value="submit" />
   </form>

in my select2WSearch.php here I will get the value of find

$find = ($_POST['find']) ? $_POST['find'] : $_GET['find'];
var_dump ($find);

The problem is when I fill up and submit the form my select2WSearch.php can't get the value of name"find". I var_dump the this var_dump ($find); but it said string 'undefined' (length=9).
Help please, I need to get the value of that to the other page, thanks in advance.

Upvotes: 0

Views: 64

Answers (2)

RAN RAN
RAN RAN

Reputation: 33

This solve the problem someone post it in here but he just deleted it

function changeLink(link) {
     var value = document.getElementsByName('find')[0].value;
     parent.iframe_a2.location=link + "?find=" + value
}

In that I can get the value of name="find" in select2WSearch.php the only problem is i also need name="field" value in select2WSearch.php just addional codes will do help pls.

Upvotes: 1

CoderKK
CoderKK

Reputation: 361

the problem is that you sending your data as 'get' and you trying to access those data using 'post'.try $find = $_GET["find"];

Upvotes: 0

Related Questions