• Resolved sinciasar

    (@sinciasar)


    Hi there,

    I am trying to implement this code into the page, so my client can query about his reports and show if there is one with the exact serial no. But when I use the variable “id”, it is redirecting to the link of; https://www.ozguncicek.com.tr/wp-content/uploads/Rapor4714.pdf

    (Since your plugin’s shortcode is set forth as “id”)

    But when I change the id variable to something else (for example ida).. this time it redirecting to only https://www.ozguncicek.com.tr/wp-content/uploads/Rapor.pdf

    (See, without the serial number)

    Right now this code is on the site, live; (which is directing to a link without serial number)

    <?php
    if(isset($_POST['submit']))
    {
        $ida = $_POST['ida'];
        echo "https://www.ozguncicek.com.tr/wp-content/uploads/Rapor".$ida.".pdf";
    }
    ?>
    <form method="post" target="_blank" action="<? echo "https://www.ozguncicek.com.tr/wp-content/uploads/Rapor".$ida.".pdf"; ?>">
       <input type="text" name="ida"><br>
       <input type="submit" name="submit" value="Sorgula"><br>
    </form>

    And working code is this; (But this is working with your plugin’s “id” variable :p)

    <?php
    if(isset($_POST['submit']))
    {
        $id = $_POST['id'];
        echo "https://www.ozguncicek.com.tr/wp-content/uploads/Rapor"."$id".".pdf";
    }
    ?>
    <form method="post" target="_blank" action="<? echo $_SERVER['PHP_SELF']; ?>">
       <input type="text" name="id"><br>
       <input type="submit" name="submit" value="Sorgula"><br>
    </form>

    Could you please help me with this? I could not figure it out why ??

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter sinciasar

    (@sinciasar)

    Btw.. I removed the double quotes around ida variable on my last try.

    Even with them around, its not working 🙁

    Plugin Author webcraftic

    (@webcraftic)

    Hi,

    Sorry delay for reply!

    You have access to shortcode attributes, one of the attributes is id. So when you refer to the $id variable you get the shortcode id. To make your code work correctly, just use another variable name. For example: $item_id

    Best regards, Alex

    • This reply was modified 7 years ago by webcraftic.
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘A Weird Problem About Php Variable.’ is closed to new replies.