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

180
Vistas
Modifying GET parameter on PHP

I'm very newbie to this, so let me explain the issue:

I have a cashback script, the retailer title is stored in the database, my links looking like that:

example.com/view_retailer.php?id=232

I want to change that to /view_retailer?title=retailer-title

I can't figure why its not working, I have on my DB the columns retailer_id, title and retailer_url. Retailer_url is empty.

if (!function_exists('GetRetailerLink')) {
    function GetRetailerLink($retailer_id, $retailer_title = "") {
        $retailer_id = (int)$retailer_id;

        $retailer_link = SITE_URL."view_retailer.php?id=".$retailer_id;
        return $retailer_link;

In php page view_retailer:

if (isset($_GET['id']) && is_numeric($_GET['id']))
    {
        $retailer_id = (int)$_GET['id'];
    }
    else
    {       
        header ("Location: index.php");
        exit();
    }

I played already around with the code below but this is not working -> shop not found.

if (!function_exists('GetRetailerLink')) {
    function GetRetailerLink($retailer_id, $retailer_title = "") {
        $retailer_id = (int)$retailer_id;

        $retailer_link = SITE_URL."view_retailer.php?title=".$retailer_title;
        return $retailer_link;

and

if (isset($_GET['title']) && is_numeric($_GET['title']))
                {
                    $retailer_title = (int)$_GET['title'];
                }
                else
                {       
                    header ("Location: index.php");
                    exit();
                }

How can I solve this problem? Thanks for helping me!


Thank you for the proposed solutions

I tried it now with

if (!function_exists('GetRetailerLink')) {
    function GetRetailerLink($retailer_id, $retailer_title = "") {
        $retailer_id = (int)$retailer_id;

        $retailer_link = SITE_URL."view_retailer.php?title=".$retailer_title;
        return $retailer_link;

and

if (isset($_GET['title']) && is_string($_GET['title']))
{
    $retailer_title = (string)$_GET['title'];
}
else
{       
    header ("Location: index.php");
    exit();
}

also tried it with

if (isset($_GET['title']))
            {
                $retailer_title = (int)$_GET['title'];
            }
            else
            {       
                header ("Location: index.php");
                exit();
            }

Unfortunately, that doesn't fix the problem either -> Shop not found.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You will have to remove is_numeric($_GET['title']) in your code.

is_numeric($_GET['title']) will check if the variable is a number or a numeric string.

over 4 years ago · Santiago Trujillo Denunciar

0

Perhaps you can try removing is_numeric? Since title is a character string, that will return false always.

if (isset($_GET['title']))
            {
                $retailer_title = $_GET['title'];
            }
            else
            {       
                header ("Location: index.php");
                exit();
            }

Hope this works for you :)

over 4 years ago · Santiago Trujillo 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