Question

I have a program that generates a link and I want to change how the link appears go get a modification to work. I have not been able to figure out where and how the link in generated. I just thought it would be easier to change the end product to what I needed.

The code generates a link like this:

 report/custom_report.php?printable=1&pdf=0&LBF013_13370=72517&

The code that generates the link is this:

 a href="custom_report.php?printable=1&<?php print postToGet($ar); ?>

I need the link to be this:

 report/custom_report.php?printable=1&LBF013_13370=72517&

I have tried this:

$link = postToGet($ar);
$find = 'pdf=0';
$Nlink = strpos($link, $find); 
print $link;

But it returns just the 0 only. If I print to the screen $link I get

pdf=0&LBF013_13370=72517&

Should I be using a different command to change this string? I thought that if I loaded it into a variable the strpo would work to remove the pdf=0 and leave the rest. Then my code mod would work.

Thanks in advance.

Was it helpful?

Solution

You need str_replace rather than str_pos:

$finalLink = str_replace('pdf=0','',$link)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top