I have a href in my php code to edit or remove photos from the site.
echo("<a href='photohandling.php?action=1&file=".$iPictureNumber."'><img height='35' src='./pictures/delete.png' border='0' ></a>");
But the code only works sometimes. The photohandling.php isn't fired up everytime. I put an echo inside the photohandling.php to see if the file is used. And most of the times it doesn't. Why? Is the code not solled or is this a problem of the browser?
Anyone an idea? Thanks in advance.
Edit: None of the solutions worked thus far. Thanks for thinking along. But let me further clearify the problem:
href='photohandling.php?action=1&file=2'> then the photohandling.php fires up
href='photohandling.php?action=1&file=3'> then the photohandling.php doesn't work
href='photohandling.php?action=1&file=4'> the photohandling.php fires up
href='photohandling.php?action=1&file=5'> the photohandling.php fires up
The next time only 2 and 5 works, then only the first, then none of them, etc
They are generated by an FOR loop. Thats whats so puzzling about it, its just a parameter.
And if anyone has an alternative solution to this, please youre welcome. This project has to be done in a couple of weeks.
Try this:
echo "<a href='photohandling.php?action=1&file={$IPictureNumber}'><img height='35'src='./pictures/delete.png' border='0' ></a>";
The single quotes mean $IPictureNumber isn't being treated as a variable, so t needs to be enclosed in curly brackets. Also make sure you are poitning the photohandling.php in the right location. If it's in a higher level use "../photohandling.php" etc
You need to provide the absolute URL to the file. If it's in your root, try this:
echo("<a href='/photohandling.php?action=1&file=".$iPictureNumber."'><img height='35' src='./pictures/delete.png' border='0' ></a>");
Otherwise it will append the file to the current URL, so if you're on http://example.com/test , it will try to reach http://example.com/test/photohandling.php .
echo '<a href="../photohandling.php?action=1&file='.$iPictureNumber.'"><img height="35" src="./pictures/delete.png" border="0" >Link Name</a>';
尝试使用../ ( dot-dot-slash ) 进入父文件夹,然后包含文件名。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.