bas7320 Posted November 10, 2007 Share Posted November 10, 2007 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 Quote Link to comment Share on other sites More sharing options...
MadTechie Posted November 10, 2007 Share Posted November 10, 2007 use urlencode to encode if first then decode it <?php echo '<a href="mycgi?foo=', urlencode($userinput), '">'; ?> more info here http://php.net/manual/en/function.urlencode.php Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 10, 2007 Share Posted November 10, 2007 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 Quote Link to comment Share on other sites More sharing options...
bas7320 Posted November 10, 2007 Author Share Posted November 10, 2007 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? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 10, 2007 Share Posted November 10, 2007 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.