Solved

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

Posted on 2009-04-01
6
248 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 109

Expert Comment

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

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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 109

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 109

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

856 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