Jump to content

[SOLVED] php list menu pls help


ctcp

Recommended Posts

 

i got texfield (for search) list menu (1 or 2) and Button (Search)

how to

if i search test  type 1 (i whant this result to my page)  mysite.com/1/?query=test&type=1

if i search test  type 2 (i whant this result to my page)  mysite.com/2/?query=test&type=2

 

 

<form name="form1" method="get" action="">
  <label for="query1"></label>
  <input type="text" name="query1" id="query1">
  <label for="type"></label>
  <select name="type" id="type">
    <option value="1">1</option>
    <option value="2">2</option>
  </select>
  <label for=""></label>
  <input type="submit" value="Search">
</form>

 

Thanks for the Help

 

Link to comment
https://forums.phpfreaks.com/topic/168051-solved-php-list-menu-pls-help/
Share on other sites

no you don't understant ..

i got 2 directoris

one is test1

and    test2

 

i whant make one texfield list menu search button

if i search for TEST (texfield) and select options 1 (form list menu)  i whant my search redirect me to mysite.com/test1/?query=test&type=1

type is my options from list menu

if i search for TEST (texfield) and select options 1 (form list menu)  i whant my search redirect me to test2/?query=test&type=2

ok, i understand now i think... you could do this with javascript... but to accomplish it with php, have an intermediary page, that will check the value of $_GET['type'] and use a header redirect accordingly...

 

example...

header("Location: /test".$_GET['type']."/?query=".$_GET['query']."&type=".$_GET['type']);

 

hope that helps...

It's hard to understand what you want to do, I think foo gave some good explanations.  If those are off, then what you're explaining must be off...

can help me pls how to?

im new in php

header("Location: /test".$_GET['type']."/?query=".$_GET['query']."&type=".$_GET['type']);

add this line where?

 

ok, keep your form action empty... and place this at the very top of the same script...

 

if(isset($_GET['type']))
{
  header("Location: /test".$_GET['type']."/?query=".$_GET['query']."&type=".$_GET['type']);
}

 

now that should redirect once you submit, and you should see it try and redirect accordingly...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.