Jump to content

something wrong with getting a value from adres bar


clankill3r

Recommended Posts

i have this in the adressbar:

truncate.php?msg=historer_words

 

but on screen i get,

why

instead of the expected:

Truncated <? $_GET['mgs'] ?>

 

Does someone sees what's wrong in my script?

 

<?php 

?>

<html>
<head>
	<title>Historer : Truncate</title>
</head>

<body>

	<? 
	if(isset($_GET['mgs'])) {
		?><div id="message">Truncated <? $_GET['mgs'] ?></div> <?	
	} else {
		?><div id="message">why </div> <?	
	}		
	?>

	<div id="container">
		<a href="inc/php/utils/truncate.php?table=historer_words">Truncate words</a>
	</div>
</body>
</html>

Link to comment
Share on other sites

Note that you spelled "address" wrong in your thread title.  Note also that you spelled "msg" wrong in your code.

 

Programming takes an enormous amount of precision.  if you're off by one letter, like you are here, nothing will work.  Make sure you are more careful.

Link to comment
Share on other sites

php.net: Escaping from HTML

 

while some people find short tags and ASP style tags convenient, they are less portable, and generally not recommended.

 

Also note that if you are embedding PHP within XML or XHTML you will need to use the <?php ?> tags to remain compliant with standards.

 

Short tags (example three) are only available when they are enabled via the short_open_tag php.ini configuration file directive, or if PHP was configured with the --enable-short-tags option.

 

Using short tags should be avoided when developing applications or libraries that are meant for redistribution, or deployment on PHP servers which are not under your control, because short tags may not be supported on the target server. For portable, redistributable code, be sure not to use short tags.

 

however

Starting with PHP 5.4, short echo tag <?= is always recognized and valid, regardless of the short_open_tag setting.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.