Jump to content

Pulling Characters with GET method


bas7320

Recommended Posts

I am passing various text variables via a URL to a form that uses a command as follows:

 

name="recid" value="<? echo $_GET['recid'] ?>"

 

An example of a recid value that I am passing is 57L2J60)K#LLA:Y however this is being truncated to 57L2J60)K.

 

What can I use to make sure that the full text is captured and not truncated?

 

Steve

Link to comment
Share on other sites

The "#" has a special meaning when it's in a URL. You can try using the urlencode() function:

name="recid" value="<?php echo urlencode($_GET['recid']) ?>"

 

MadTechie beat me to it... :)

 

Ken

 

 

That sort of worked however it still truncated at another character, the ")". Any other thoughts?

Link to comment
Share on other sites

I just did a quick test, the following shows that using urlencode() works:

<?php
if (isset($_GET['test']))
  echo '<pre>' . print_r($_GET,true) . '</pre>';
  
$str = '57L2J60)K#LLA:Y';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<title></title>
</head>

<body>
<a href="?test=<?php echo $str; ?>">test 1</a><br>
<a href="?test=<?php echo urlencode($str); ?>">test 2</a><br>
</body>
</html>

 

Ken

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.