Solved

How do I get a web URL formatted correctly in a string?

Posted on 2009-04-01
6
252 Views
Last Modified: 2012-05-06
It keeps cutting it off the url at about the <?php echo ltrim when displayed in the <a href=<?php echo $url ?>>
if (substr($misc,0,1) == 'g')
	$url = 'org.php?id=<?php echo ltrim($misc,"g")?>&amp;ts=<?php echo $time?>&amp;h=<?php echo md5($misc.$time.$secret); ?>';
	else
	$url='pro.php?id=<?php echo ltrim($misc,"u")?>&amp;ts=<?php echo $time?>&amp;h=<?php echo md5($misc.$time.$secret); ?>';

Open in new window

0
Comment
Question by:chrisjmears
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 24044442
Show us a sample of what you want it to say, please.  Thanks, ~Ray
0
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 24044468

// MAYBE LIKE THIS?
   $url  = 'org.php?id=';
   $url .= ltrim($misc,"g");
   $url .= '&ts=';
   $url .= $time;
   $url .= '&h=';
   $url .= md5($misc.$time.$secret);
 
// SEE THE RESULT
   print_r($url);

Open in new window

0
 

Author Comment

by:chrisjmears
ID: 24044567
Perfect thanks!
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 110

Expert Comment

by:Ray Paseur
ID: 24044682
Great!  I always find that simple statements are easier to write and debug compared to compound statements.  This usually leads to two responses.  One is from new programmers. They say, "but that's so simple..."  The other is from experienced programmers.  They say, "Very clear..."  Either way, I save a lot of time debugging!

;-)

Ray
0
 

Author Comment

by:chrisjmears
ID: 24044735
I like your style! Easy is better! thanks again!
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 24044743
Roger that!  

Best regards, ~Ray
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Wordpress Query 5 43
issue with DB import 1 36
$_SERVER Variable question 31 50
CURL sending XML without spaces PHP 5 30
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question