Solved

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

Posted on 2009-04-01
6
239 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

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…
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…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

776 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