I'm using xampp on XP.

I can't get PHP to read my var from the URL. example, when I hit www.foobar.com/whatever.php?azz=wala then I should get wala to print to the browser with the following code. Any ideas??

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>Untitled</title>
</head>

<body>
	before
<?php
  echo "middle  ".$azz."  zoo";
  echo "aftermiddle";
?>
	after
</body>
</html>

Recommended Answers

All 5 Replies

I'm using xampp on XP.

I can't get PHP to read my var from the URL. example, when I hit www.foobar.com/whatever.php?azz=wala then I should get wala to print to the browser with the following code. Any ideas??

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>Untitled</title>
</head>

<body>
	before
<?php
  echo "middle  ".$azz."  zoo";
  echo "aftermiddle";
?>
	after
</body>
</html>

Your below script modified will do the same -

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>Untitled</title>
</head>

<body>
	before
<?php
  echo "middle  ".$_GET['azz']."  zoo";
  echo "aftermiddle";
?>
	after
</body>
</html>

coz. you directly use $azz variable without first defining it...
define it like this

$azz = $_GET;

just put that above your code, befor you output $azz.

both of those were good ideas but neither worked. there might be something special needed to echo it?

i resolved my root problem though, i was using this as a test to get my variable names. i had some old script that didn't have the single parenthesis around the var in the condition. it used to work though, maybe a newer version php requires this.

Thanks!

Actually vault that was the final half, it didn't work 100% til defining it. PHP seems much more strict in windows w/ xampp defaults. Anyway Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.