Jump to content

$_GET( )


jx2012

Recommended Posts

Hi there,

 

I am new to this forum want to say Hi  to everyone  :).

I just learn a little bit of PHP. I couldn't figure this out. Could someone please help me? Many thanks.

 

1. when I ran the 1st code below, it showed me "thank you" in the browser.

    <?php

    $title=$_GET[title];

    echo $title;

    ?>

 

2. when I ran the 2nd code below, I got what I wanted.

    <?php

    $sql = "SELECT * FROM mytable WHERE title='thank you' ";

    ...

    ?>

 

3. when I ran the 3rd code below, it showed me a blank page  ;D.

    <?php

    $title=$_GET[title];

    $sql = "SELECT * FROM mytable WHERE title='<?php echo $title; ?>' ";

    ...

    ?>

 

How to make the 3rd code work like the 2nd one? It seems a php code under php is NOT working.

Link to comment
https://forums.phpfreaks.com/topic/262541-_get/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.