Jump to content

HTTP GET not working.


KyleVA

Recommended Posts

echo $data1;

 

try this

 

<?php
$data1 = $_GET['data1'];
echo $data1;
?>

 

Both of you, worked like a charm.

 

I appreciate the quick response, I'm new to PHP so maybe you guys can assist me with problems in the future.

 

:thumbs up:

 

$data1 = $_GET['data1']; is an assignment statement. The output to the browser by the original code is <body></body>. What were you expecting to be displayed?

 

Ahh, makes sense - the $_GET tells the browser to grab the information from the URL and the echo displays it. When is it appropriate to use print vs echo?

Link to comment
https://forums.phpfreaks.com/topic/154383-http-get-not-working/#findComment-811703
Share on other sites

Ahh, makes sense - the $_GET tells the browser to grab the information from the URL and the echo displays it. When is it appropriate to use print vs echo?

 

For the most part, use which ever you prefer. See this discussion (linked to from the php manual) :

 

http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40

Link to comment
https://forums.phpfreaks.com/topic/154383-http-get-not-working/#findComment-811715
Share on other sites

echo $data1;

 

try this

 

<?php
$data1 = $_GET['data1'];
echo $data1;
?>

 

Both of you, worked like a charm.

 

I appreciate the quick response, I'm new to PHP so maybe you guys can assist me with problems in the future.

 

:thumbs up:

 

$data1 = $_GET['data1']; is an assignment statement. The output to the browser by the original code is <body></body>. What were you expecting to be displayed?

 

Ahh, makes sense - the $_GET tells the browser to grab the information from the URL and the echo displays it. When is it appropriate to use print vs echo?

perhaps you should read up a little on echo and print.

Link to comment
https://forums.phpfreaks.com/topic/154383-http-get-not-working/#findComment-811716
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.