Title: A Weird Problem About Php Variable.
Last modified: March 11, 2019

---

# A Weird Problem About Php Variable.

 *  Resolved [sinciasar](https://wordpress.org/support/users/sinciasar/)
 * (@sinciasar)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/a-weird-problem-about-php-variable/)
 * 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/](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/](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](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fa-weird-problem-about-php-variable%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [sinciasar](https://wordpress.org/support/users/sinciasar/)
 * (@sinciasar)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/a-weird-problem-about-php-variable/#post-11300539)
 * Btw.. I removed the double quotes around ida variable on my last try.
 * Even with them around, its not working 🙁
 *  Plugin Author [webcraftic](https://wordpress.org/support/users/webcraftic/)
 * (@webcraftic)
 * [7 years ago](https://wordpress.org/support/topic/a-weird-problem-about-php-variable/#post-11351522)
 * 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](https://wordpress.org/support/users/webcraftic/).

Viewing 2 replies - 1 through 2 (of 2 total)

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

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3475630)
 * [Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts](https://wordpress.org/plugins/insert-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-php/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-php/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [webcraftic](https://wordpress.org/support/users/webcraftic/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/a-weird-problem-about-php-variable/#post-11351522)
 * Status: resolved