Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2009-04-01
6
Medium Priority
?
280 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
  • 4
  • 2
6 Comments
 
LVL 111

Expert Comment

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

Accepted Solution

by:
Ray Paseur earned 2000 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 111

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 111

Expert Comment

by:Ray Paseur
ID: 24044743
Roger that!  

Best regards, ~Ray
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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 look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

972 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