#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Posts
    1
    Rep Power
    0

    Question


    I need some help with a php script. I'm trying to send a variable to another php file within the wml-url :

    if(mysql_num_rows($fagTabell) > 0)
    {
    while($row=mysql_fetch_array($fagTabell))

    print "<a href=\"dato.php?fagkode=" . row["fagkode"] . "\">" . $row["fagbeskrivelse"] . "</a><br/>";

    }//while
    }//if

    These lines creates wml-urls, where "row["fagkode"] is to be sent with the url..It seems like I have managed to send it, but I can't use the variable in dato.php...

    I've tried this in dato.php :

    $kode=HTTP_GET_VARS["fagkode"];
    echo"<p>$kode</p>";

    (wich only creates the error "Unsupported content-type: text/html")

    or just :

    print"$fagkode";
    doesn't print anything at all).

    Could use some help here!

    Ole Kristian

    Comments on this post

    • Gran Roguismo agrees
  2. #2
  3. No Profile Picture
    ...try and try again
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    Lake Forest, CA, USA
    Posts
    182
    Rep Power
    14
    Hi Ole,

    From the code you supplied it looks like you're missing a curly bracket:

    while($row=mysql_fetch_array($fagTabell)) { <- This one

    Hope this clears up your problem.

    Ben
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    10
    Rep Power
    0
    Try this, instead:

    if(mysql_num_rows($fagTabell) > 0)
    {
    while($row=mysql_fetch_array($fagTabell))

    print "<a href=\"dato.php?fagkode=$row["fagkode"]\">$row["fagbeskrivelse"]</a><br/>";

    }//while
    }//if

    (you have type row["fagkode"] instead of $row["faqkode"], and you can embebed your php variables in strings)...

    Ah! don't forget to print the wml header, when you are writing WAP applications, before print something, just put this in your code:

    print("Content-type: text/vnd.wap.wml\r\n\r\n");

    this is the standard wap.wml header and will tell that your file is using this protocol...

    Happy WAPPy...

IMN logo majestic logo threadwatch logo seochat tools logo