Announcement

Collapse
No announcement yet.

PHP passing variables

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP passing variables

    hello
    i have this code :
    Code:
    <?php
    $city=$_GET['city'];
    $category=$_GET['category'];
    echo '<a href="[URL="http://www.myweb.com/addform.php?city=$city&quot;>'.'"]http://www.myweb.com/addform.php?city=$city">'.'[/URL]['.'Add form'.']'.'</a>';
    ?>
    the link to this page contains .php?city = abcd
    and in the echo link it suppose to convert the $city from thr top to abcd
    why it isnt doint that ?

    any ideas ?


    thanks

  • #2
    Re: PHP passing variables

    Because the $city inside single quotes is interpreted as text. Make it:

    <?php
    $city=$_GET['city'];
    $category=$_GET['category'];
    echo "<a href=\"http://www.myweb.com/addform.php?city=$city\">".'['.'Add form'.']'.'</a>';
    ?>
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

    Comment

    Working...
    X