Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php]switch & switch 2 - ( & ) Podwojny adres! pomocy!
kkingstoun
post 9.11.2007, 21:41:49
Post #1





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 9.11.2007

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


Witam mam taki problem, ze kompletnie nie mam pojęcia jak to zrobic. Chciałbym stworzyć cos takeigo

index.php?zmienna1=abc&zmienna2=de

BO teraz mam zastosowane 2 switche które wypełniaja mi 2 rozne tabelki. Tylko jestli aktywuje jedna a potem 2 to wraca mi do index.php . Ktos potrafi to zrobic?? Pomocy!! Dokłądnie chodzi mi o ten znaczek & aby to sie dopisywayła i aby powstawal podwójny adress.


Tak wygladaja obydwa switche:

Na stronie
<? include ("coikto.php"); ?>

switch

<?
switch ($_GET['id'])
{
case ("home"):
include ("home.html");
break;

case ("wstep"):
include ("wst.html");
break;

case ("statut"):
include ("stat.html");
break;

case ("historia"):
include ("historia.html");
break;

case ("uczniowie"):
include ("uczniowie.html");
break;

case ("zdjecia"):
include ("zdj.html");
break;

case ("rodzice"):
include ("rod.html");
break;

case ("nauczyciele"):
include ("naucz.html");
break;

case ("euro"):
include ("euro.html");
break;

//( ... )
default:
include ("witaj.html");
}
?>


2 :
Na stronie <? include ("newsy.php"); ?>
switch

<?
switch ($_GET['arch'])
{
case ("2"):
include ("arch2.html");
break;

case ("3"):
include ("arch3.html");
break;

case ("4"):
include ("arch4.html");
break;

case ("4"):
include ("arch4.html");
break;

case ("4"):
include ("arch4.html");
break;

case ("4"):
include ("arch5.html");
break;

case ("5"):
include ("arch5.html");
break;

case ("6"):
include ("arch6.html");
break;

case ("7"):
include ("arch7.html");
break;

case ("8"):
include ("arch9.html");
break;

case ("9"):
include ("arch9.html");
break;

case ("10"):
include ("arch10.html");
break;
//( ... )
default:
include ("news1.html");
}
?>
Go to the top of the page
+Quote Post
starr
post 9.11.2007, 22:25:11
Post #2





Grupa: Zarejestrowani
Postów: 27
Pomógł: 0
Dołączył: 16.10.2007

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


Powiem, że trudno odgadnąć Twoje intencje, ale może chodzi o to:

$a = $_GET['a'];
$b = $_GET['b'];

if($a <> "")
{
przełącznik a
}

if($b<> "")
{
przełącznik b
}

starr
----------------------------
www.aleproste.pl
Go to the top of the page
+Quote Post
kkingstoun
post 10.11.2007, 11:17:20
Post #3





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 9.11.2007

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


Napisze to jeszcze raz:

Kilkam na jeden link na stronie który wywołuje mi pierwszego switcha tzn

www.costam.info/index.php?id=1

Teraz wywoluje inny witch (inny plik i inne include, inna tabelka)

i chcialbym aby powstawał taki link www.costam.info/index.php?id=1&arch=1

Ogolnie chodzi o to aby powstawał ten znaczek&

W tym momencie jest tak, ze po wywolaniu 2 switcha powstaje mi taki link

www.costam.info/index.php?arch=1


Pomocy
Go to the top of the page
+Quote Post
Darti
post 10.11.2007, 11:30:59
Post #4





Grupa: Zarejestrowani
Postów: 1 076
Pomógł: 62
Dołączył: 6.03.2005
Skąd: Wroc

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


  1. <?php
  2. $get = $_GET;
  3. $get['id'] = isset($get['id']) ? $get['id'] : 1; 
  4. $get['arch'] = isset($get['arch']) ? $get['arch'] : 1; 
  5.  
  6. $url = http_build_query($get);
  7.  
  8. echo '<a href="http://www.costam.info/index.php?'. $url .'">';
  9. ?>


Ten post edytował Darti 10.11.2007, 11:32:22


--------------------
The answer is out there, Neo. It's looking for you. And it will find you, if you want it to.
SERVER_SOFTWARE : Apache/2.2.4 (Win32) PHP/5.2.1
MySQL Client API version : 5.0.27
Go to the top of the page
+Quote Post
kkingstoun
post 10.11.2007, 14:06:56
Post #5





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 9.11.2007

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


A gdzie ja mam to zastosować?
Go to the top of the page
+Quote Post
marcio
post 10.11.2007, 15:27:49
Post #6





Grupa: Zarejestrowani
Postów: 2 291
Pomógł: 156
Dołączył: 23.09.2007
Skąd: ITALY-MILAN

Ostrzeżenie: (10%)
X----


omg koles jak to gdzie pomysl???Jak robisz link na strone glowna to robisz tak jak ci pokazal Darti tylko ze dajesz wartosci dla zmiennych GET.Darti dzieki ze pokazales ze jest taka funckja bo nie wiedzialem bardzo sie przyda dla takich linkow a nie mozna tego zrobic bez tej funckji http_build_query()questionmark.gif?np tak??
  1. <?php
  2. echo('<a href="http://twojastrona.pl/index.php?id=$id'.&.'arch=$arch">home</a>');
  3. ?>

questionmark.gifquestionmark.gif


--------------------
Zainteresowania: XML | PHP | MY(SQL)| C# for .NET | PYTHON
http://code.google.com/p/form-builider/
Moj blog
Go to the top of the page
+Quote Post
Darti
post 10.11.2007, 15:34:23
Post #7





Grupa: Zarejestrowani
Postów: 1 076
Pomógł: 62
Dołączył: 6.03.2005
Skąd: Wroc

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


innym z wielu sposobów jest coś zbliżonego do tego, co napisał wyżej @starr


--------------------
The answer is out there, Neo. It's looking for you. And it will find you, if you want it to.
SERVER_SOFTWARE : Apache/2.2.4 (Win32) PHP/5.2.1
MySQL Client API version : 5.0.27
Go to the top of the page
+Quote Post
kkingstoun
post 11.11.2007, 20:11:03
Post #8





Grupa: Zarejestrowani
Postów: 5
Pomógł: 0
Dołączył: 9.11.2007

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


Sorka, ale nie mam wyobrazni do tego:/

To jest moja stronka http://asnyk.radion.info/index2.php Uruchomcie historia potem zmień news(archiwum news). Jak zaobserwujecie po zmaine newsa, wrócimy spowrotem do idnex2.php:/. Kurde naprawde nie wiem gdzie mam to uzyć w kodzie:/

Odswiezam temat:)
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 Wersja Lo-Fi Aktualny czas: 12.07.2025 - 09:16