Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

89
Vistas
dynamically passing href in anchor tag

i want to redirect user to registration based on there role. like there is two roles user and shop if user select user role then it will be directed to the ragic.php(registration customer) if selected shop then ragis.php Hear is the code...

 Link: `<td colspan=3 align="center"><font size=6 ><a onclick="return check_role()" href="" id="ref" name="Ragistration">Ragistration</a>`

Selecting Role: 

<select id="role" name="role">
                        <option value="ragic.php">user</option>
                        <option value="shop/ragis.php">shop</option>
                    </select>
Java Script Function :

 function check_role()
            {
                    var r=document.getElementById('role').value;
                    alert(r);
                    document.getElementById("ref").value = test;                    
            }
                

one problem is how i pass a javascript variable into anchor href. or i also try for php hear is code

  if(@isset($Ragistration))
{
    if(@$role=="shop")
    $r="shop/ragis.php";
elseif(@$role=="user")
    $r="ragic.php";

}

and for php anchor tag will be <a href="<?php echo $r?>" ></a>

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Update your JavaScript function like this:

function check_role()
{
  var r=document.getElementById('role').value;
  alert(r);
  location.href = r;
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda