Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP] +1 w linku
goransol
post
Post #1





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 18.09.2010

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


Witam próbuje w php zrobić iż jeśli nacisnę na buttona to do linka href doda +1 Podam przykład by to lepiej za obrazować...

<?php

$n = $_GET['nr'] +1;

if ($_GET['nr'] == 1 || $_GET['nr'] == 12 )

echo '<form action="" method="POST">
<input type="image" name="next" class="but1" class="submit" /></div>
</form>';
else {

echo '<form action="" method="POST">
<input type="image" name="next" alt="n" class="but1" class="submit" /></div>
</form>

<form action="" method="POST">
<input type="image" name="back" alt="n" class="but2" class="submit" /></div>
</form>
';
}

if ($_POST['next']) {





I teraz problem jak wrzucić ten $n do hrefa powiedzmy że mam index.php?nr=1, a po naciśnięciu na button uzyskał w linku index.php?nr=2 i tak dalej...
Zastanawiam się jak to wykonać... jakieś pomysły (IMG:style_emoticons/default/questionmark.gif) ?
Go to the top of the page
+Quote Post
yevaud
post
Post #2





Grupa: Zarejestrowani
Postów: 471
Pomógł: 89
Dołączył: 29.07.2008
Skąd: Warszawa

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


nie rozumiem pytania
  1. echo '<a href="index.php?nr=' . $n . '">nastepny</a>';
?

Ten post edytował yevaud 18.09.2010, 12:21:51
Go to the top of the page
+Quote Post
goransol
post
Post #3





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 18.09.2010

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


Sorki za temat bo to było banalnie proste .... wystarczy w form action podać co ma robić...


<?php

$n = $_GET['nr'] +1;
$b = $_GET['nr'] -1;

if ($_GET['nr'] == 1 || $_GET['nr'] == 12 )

echo '<form action="index.php?nr=' .$n. '" method="POST">
<input type="image" name="next" alt="n" class="but1" class="submit" /></div>
</form>';
else {

echo '<form action="index.php?nr=' .$n. '" method="POST">
<input type="image" name="next" alt="n" class="but1" class="submit" /></div>
</form>

<form action="index.php?nr=' .$b. '" method="POST">
<input type="image" name="back" alt="n" class="but2" class="submit" /></div>
</form>
';
}

?>


Proszę o zablokowanie tematu.

Ten post edytował goransol 18.09.2010, 17:04:14
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 27.08.2025 - 01:57