Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
¿Cómo puedo evitar que un botón de radio se desmarque después de presionar el botón Enviar?

Estoy tratando de evitar que mi botón de opción se desmarque automáticamente después de presionar el botón Enviar. Aquí he creado una función que se supone que debe verificar el botón de opción correcto después de enviar el formulario, pero eso no funciona. También estoy bastante seguro de que hay una mejor manera de resolver esto.

Mi código:

 <html> <head> <meta charset="utf-8"> <title>Unbenanntes Dokument</title> </head> <body> <h1>Arbeitsverhältnis:</h1> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> <input type="radio" name="arbeitstyp" value="arbeiter" id="arbeiter"/>Arbeiter</input> <input type="radio" name="arbeitstyp" value="angestellter" id="angestellter"/>Angestellter</input> <input type="radio" name="arbeitstyp" value="lehrling" id="lehrling"/>Lehrling</input> <br><br> <button type="submit" name="ausgabe" value="ausgabe">Ausgabe</button> </form> <br> <hr> <br> <script> function check() { document.getElementsByName('arbeiter').checked; } </script> <?php if (isset($_POST['ausgabe'])){ if($_POST['arbeitstyp'] == "arbeiter"){ echo "Deine Arbeitszeit beginnt um 07:00 Uhr."; echo '<script>check();</script>'; } else if($_POST['arbeitstyp'] == "angestellter"){ echo "Deine Arbeitszeit beginnt um 08:00 Uhr."; echo '<script>check();</script>'; } else if($_POST['arbeitstyp'] == "lehrling"){ echo "Deine Arbeitszeit beginnt um 08:30 Uhr."; echo '<script>check();</script>'; } else { echo "bitte wähle etwas aus."; } } ?> </body> </html>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Será genial usar una sesión flash en PHP. Hay 2 escenarios en los que desea mostrar el botón de opción seleccionado. Ya sea después de la validación o después de una transacción exitosa.

Ahora, si usa una sesión flash en ambas lógicas, puede capturar esa sesión flash y mostrarla en su botón de opción.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!