Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

161
Visualizações
HTML Javascript URL Parameters not lined up in a row by klicking second time on a next button

for test and understanding for my project: I want a php-page which shows me the current date of the week and a link which I can go one week forward. In the URL I send the date to the next side, if I have a datetime in URL (so the first "next" click) it should show me the next week and also a next-Button to go to the next week (2. week) and so on... (Background is I want have a weekcalendar (Monday to Friday) with buttons previous week and next week.)

Currently I have the problem, that the browser adds in the url my sended date as a added row. But I want only one date and not the previous sended dates before.

Currently: HTTPPAGENAME/?next=1653915514?next=1653915516

If i clicked to times on next. Wrong Example

But I only want only: HTTPPAGENAME/?next=1653915516

when I click for two times.

The rest of the code is not finished, currently it is only the url-row-think.

Whats the clue on that?

<?php
    date_default_timezone_set("Europe/Berlin");
    $weekdate = time(); 
    
    $tmpstringurl = strtotime("+ 1 week", $weekdate);

if(isset($_GET['next'])) {
//Test not finished
    $tmpstringurl = strtotime("+ 1 week", $weekdate);

} else {
//Test not finished
    $tmpstringurl = strtotime("+ 1 week", $weekdate);
}

?>

<!DOCTYPE html>
<html>
    <body>

<p><label>Date: <?php echo date("d.m.Y", $weekdate) ?></label></p><br/>

<a href="" onclick="location.href=this.href+'?next='+<?php echo $tmpstringurl ?>;return false;">One week more</a>

</body>
</html>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I have re coded your snippet below.

<?php
    # By Ajmal PraveeN (AP)
    date_default_timezone_set("Europe/Berlin");
    $weekdate = time(); 
    
    $tmpstringurl = strtotime("+ 1 week", $weekdate);

if(isset($_GET['next'])) {
//Test not finished
    $tmpstringurl = strtotime("+ 1 week", $weekdate);

} else {
//Test not finished
    $tmpstringurl = strtotime("+ 1 week", $weekdate);
}

?>

<!DOCTYPE html>
<html>
    <body>

<p><label>Date: <?php echo date("d.m.Y", $weekdate); ?></label></p><br/>

<a href="/?next=<?php echo $tmpstringurl; ?>" title="One week more">One week more</a>

</body>
</html>

If this is useful upvote.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda