Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [mod_rewrite] przekazanie parametrów szukania
Lejto
post
Post #1





Grupa: Zarejestrowani
Postów: 1 385
Pomógł: 48
Dołączył: 23.05.2007

Ostrzeżenie: (0%)
-----


Mam taki kod szukajki
  1. <form action="search/" method="get">
  2. <input type="text" name="query" class="text" />
  3. <select class="select">
  4. <option value ="all">all</option>
  5. <option value ="avi">avi</option>
  6. <option value ="mp3">mp3</option>
  7. <option value ="mpeg">mpeg</option>
  8. <option value ="mpg">mpg</option>
  9. <option value ="rar">rar</option>
  10. <option value ="wma">wma</option>
  11. <option value ="wmv">wmv</option>
  12. <option value ="zip">zip</option>
  13. <option value ="mkv">mkv</option>
  14. <option value ="3pg">3pg</option>
  15. </select>
  16. <input type="submit" class="submit" value="" />
  17. </form>

w .htaccess mam taką regułę
Kod
RewriteRule ^search/(.*)$ index.php?page=search&query=$1 [L]

przenosi mnie to dobrego pliku ale nie pokazuje fazy która jest w query
var_dump tak wygląda
Kod
array(2) { ["page"]=>  string(6) "search" ["query"]=>  string(0) "" }

jak to naprawić?


Pozdrawiam


--------------------
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 10)
PiotrekM
post
Post #2





Grupa: Zarejestrowani
Postów: 130
Pomógł: 6
Dołączył: 20.12.2009

Ostrzeżenie: (0%)
-----


a jak zwrócisz się tak index.php?page=search&query=text to co wypluje var_dump?
Go to the top of the page
+Quote Post
Fifi209
post
Post #3





Grupa: Zarejestrowani
Postów: 4 655
Pomógł: 556
Dołączył: 17.03.2009
Skąd: Katowice

Ostrzeżenie: (0%)
-----


Prócz flagi L daj QSA

http://eriz.pcinside.pl/weblog/mod_rewrite...wiazac-208.html

Ten post edytował fifi209 21.02.2010, 15:01:41


--------------------
Zainteresowania: C#, PHP, JS, SQL, AJAX, XML, C dla AVR
Chętnie pomogę, lecz zanim napiszesz: Wujek Google , Manual PHP
Go to the top of the page
+Quote Post
Lejto
post
Post #4





Grupa: Zarejestrowani
Postów: 1 385
Pomógł: 48
Dołączył: 23.05.2007

Ostrzeżenie: (0%)
-----


dodałem i nic
http://localhost/maylo/maylo/index.php?pag...&query=text działa
http://localhost/maylo/maylo/search/?query=sad nie działa...


--------------------
Go to the top of the page
+Quote Post
PiotrekM
post
Post #5





Grupa: Zarejestrowani
Postów: 130
Pomógł: 6
Dołączył: 20.12.2009

Ostrzeżenie: (0%)
-----


pokaż cały plik .htaccess
Go to the top of the page
+Quote Post
Lejto
post
Post #6





Grupa: Zarejestrowani
Postów: 1 385
Pomógł: 48
Dołączył: 23.05.2007

Ostrzeżenie: (0%)
-----


Kod
RewriteEngine On
RewriteRule ^index/$ index.php
RewriteRule ^addpliki$ index.php?page=addpliki [L]
RewriteRule ^zaloguj_t$ index.php?page=zaloguj_t [L]
RewriteRule ^join$ index.php?page=join [L]
RewriteRule ^rejestracja_nowy$ index.php?page=rejestracja_nowy [L]
RewriteRule ^login_f$ index.php?page=login_f [L]
RewriteRule ^zaloguj$ index.php?page=zaloguj [L]
RewriteRule ^logout$ index.php?page=logout [L]
RewriteRule ^loginf$ index.php?page=loginf [L]
RewriteRule ^fpass$ index.php?page=fpass [L]
RewriteRule ^delete_links$ index.php?page=delete_links [L]
RewriteRule ^fpassw$ index.php?page=fpassw [L]
RewriteRule ^user/([A-z]+)$ index.php?page=user&user=$1 [L]
RewriteRule ^panel/([A-z]+)$ index.php?page=panel&user=$1 [L]
RewriteRule ^panel/$ index.php?page=panel&user=$1 [L]
RewriteRule ^register$ index.php?page=join [L]
RewriteRule ^add$ index.php?page=add [L]
RewriteRule ^search/(.*)$ index.php?page=search&query=$1 [L] [QSA]
RewriteRule ^plik/([0-9]+)$ index.php?page=plik&id=$1 [L]
RewriteRule ^przypomnienie_hasla$ index.php?page=przypomnienie_hasla [L]
RewriteRule ^fpassw$ index.php?page=fpassw [L]


--------------------
Go to the top of the page
+Quote Post
erix
post
Post #7





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




[APACHE] pobierz, plaintext
  1. RewriteRule ^search/(.*)$ index.php?page=search&query=$1 [L] [QSA]
[APACHE] pobierz, plaintext

:
[APACHE] pobierz, plaintext
  1. RewriteRule ^search$ index.php?page=search [L] [QSA]
[APACHE] pobierz, plaintext


--------------------

ZCE :: Pisząc PW załączaj LINK DO TEMATU i TYLKO w sprawach moderacji :: jakiś błąd - a TREŚĆ BŁĘDU? :: nie ponaglaj z odpowiedzią via PW!
Go to the top of the page
+Quote Post
Lejto
post
Post #8





Grupa: Zarejestrowani
Postów: 1 385
Pomógł: 48
Dołączył: 23.05.2007

Ostrzeżenie: (0%)
-----


nie chodzi, nie przekazuje w ogóle 'query'


--------------------
Go to the top of the page
+Quote Post
erix
post
Post #9





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




Pokaż var_dump dla tablicy $_SERVER (oczywiście po przesłaniu formularza).


--------------------

ZCE :: Pisząc PW załączaj LINK DO TEMATU i TYLKO w sprawach moderacji :: jakiś błąd - a TREŚĆ BŁĘDU? :: nie ponaglaj z odpowiedzią via PW!
Go to the top of the page
+Quote Post
Lejto
post
Post #10





Grupa: Zarejestrowani
Postów: 1 385
Pomógł: 48
Dołączył: 23.05.2007

Ostrzeżenie: (0%)
-----


proszę
Kod
array(36) { ["REDIRECT_STATUS"]=> string(3) "200" ["HTTP_HOST"]=> string(9) "localhost" ["HTTP_USER_AGENT"]=> string(109) "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1 (.NET CLR 3.5.30729)" ["HTTP_ACCEPT"]=> string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" ["HTTP_ACCEPT_LANGUAGE"]=> string(23) "pl,en-us;q=0.7,en;q=0.3" ["HTTP_ACCEPT_ENCODING"]=> string(12) "gzip,deflate" ["HTTP_ACCEPT_CHARSET"]=> string(30) "ISO-8859-2,utf-8;q=0.7,*;q=0.7" ["HTTP_KEEP_ALIVE"]=> string(3) "300" ["HTTP_CONNECTION"]=> string(10) "keep-alive" ["HTTP_REFERER"]=> string(29) "http://localhost/maylo/maylo/" ["HTTP_COOKIE"]=> string(96) "autologin=fb0ea33bdc695d230dca657dc16cc2ae; autologin_id=6; PHPSESSID=4fu6ph4cm8e64l8f4b5bpgun15" ["PATH"]=> string(579) "C:\Program Files\Common Files\Symbian\Tools;C:\Perl\site\bin;C:\Perl\bin;C:\Program Files\JavaFX\javafx-sdk1.2\bin;C:\Program Files\JavaFX\javafx-sdk1.2\emulator\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Common Files\Ulead Systems\MPEG;C:\Program Files\Common Files\Teleca Shared;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;c:\Program Files\Java\jdk1.6.0_12\bin;C:\Program Files\Samsung\Samsung PC Studio 3\;C:\Program Files\QT Lite\QTSystem;C:\Program Files\CSL Arm Toolchain\bin;" ["SystemRoot"]=> string(10) "C:\WINDOWS" ["COMSPEC"]=> string(27) "C:\WINDOWS\system32\cmd.exe" ["PATHEXT"]=> string(48) ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH" ["WINDIR"]=> string(10) "C:\WINDOWS" ["SERVER_SIGNATURE"]=> string(0) "" ["SERVER_SOFTWARE"]=> string(30) "Apache/2.2.6 (Win32) PHP/5.2.5" ["SERVER_NAME"]=> string(9) "localhost" ["SERVER_ADDR"]=> string(9) "127.0.0.1" ["SERVER_PORT"]=> string(2) "80" ["REMOTE_ADDR"]=> string(9) "127.0.0.1" ["DOCUMENT_ROOT"]=> string(12) "J:/Serv/www/" ["SERVER_ADMIN"]=> string(19) "webmaster@localhost" ["SCRIPT_FILENAME"]=> string(33) "J:/Serv/www/maylo/maylo/index.php" ["REMOTE_PORT"]=> string(4) "4672" ["REDIRECT_QUERY_STRING"]=> string(11) "page=search" ["REDIRECT_URL"]=> string(20) "/maylo/maylo/search/" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" ["REQUEST_METHOD"]=> string(3) "GET" ["QUERY_STRING"]=> string(11) "page=search" ["REQUEST_URI"]=> string(31) "/maylo/maylo/search/?query=test" ["SCRIPT_NAME"]=> string(22) "/maylo/maylo/index.php" ["PHP_SELF"]=> string(22) "/maylo/maylo/index.php" ["REQUEST_TIME"]=> int(1266816178) }


muszę przekazać wartość z option i input


--------------------
Go to the top of the page
+Quote Post
erix
post
Post #11





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




Ech, dopiero teraz zauważyłem swój błąd...
[APACHE] pobierz, plaintext
  1. RewriteRule ^search$ index.php?page=search [L,QSA]
[APACHE] pobierz, plaintext


--------------------

ZCE :: Pisząc PW załączaj LINK DO TEMATU i TYLKO w sprawach moderacji :: jakiś błąd - a TREŚĆ BŁĘDU? :: nie ponaglaj z odpowiedzią via PW!
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 07:04