Hello fellow helpers :) I have the issue that I want to show a specific one of 30 images, depending on a value which is sent by an access-query into a website. I searched the netfor many answers, and some came close, yet never to where I wanted. Is there anyone that can help me out with this. It can be JS or PHP, both is fine.
你好帮助者:)我有一个问题,我想显示30个图像中的特定一个,具体取决于访问查询发送到网站的值。我在网上搜索了许多答案,有些人接近了,但从未到过我想要的地方。有没有人可以帮助我解决这个问题。它可以是JS或PHP,两者都很好。
So as an example: Value hits 1376, then the image will be number 4, when the value hits 1377 the image should be number 5. Value should be easily changeable.
例如:值命中1376,然后图像将为数字4,当值达到1377时,图像应为数字5.值应易于更改。
Thanks for any suggestions.
谢谢你的任何建议。
This did not do, what it should - but looks like something that might be easily edited (if you know how).
这没有做到,它应该做什么 - 但看起来像是可以轻松编辑的东西(如果你知道如何)。
This should have been a website, where a specific number is shown (betweeen 1 and 10000), depending on achievements. When this value hits a certain minimum-value, I would want to show the corresponding image. For when it is below 1000, it would show "under 10%"-image. Between 1000 and 1499 it would be the "close to 15%"-image. So actually a visualisation of the progress. Not as a bar, but as images. Imageine a house being build and with every number, one more stone is put onto the fundament. That would be the intention. I hope that makes sense now. If not, don't flag the whole question, but ask.
这应该是一个网站,根据成就显示一个特定的数字(1到10000之间)。当此值达到某个最小值时,我想显示相应的图像。当它低于1000时,它将显示“低于10%” - 图像。在1000到1499之间,它将是“接近15%” - 图像。所以实际上是进展的可视化。不是作为一个酒吧,而是作为图像。想象一个正在建造的房子,每个数字,还有一块石头被放在基础上。那就是意图。我希望现在有道理。如果没有,请不要标记整个问题,但要问。
1 个解决方案
#1
0
<form action="<?php echo php ?>" method = "post" >
<input type="text" name="number" value="1376" onchange="this.form.submit()" />
</form>
<?php
$path = '4.jpg';
$value = $_POST['number'];
if(!(empty($value)){
$path = explode($path,'.');
switch($value) {
case 1366:
$path = 4; //incrementing by one
break;
case 1367:
$path = 5; //incrementing by one
break;
default:
$path = 4;
break;
}
}
$path = $path.'.'.$path[1];
?>
<img class="hidden" src="<?php echo $path ?>"/>
this one uses case structure. Set as you wish.
这个使用案例结构。根据需要设置。
#1
0
<form action="<?php echo php ?>" method = "post" >
<input type="text" name="number" value="1376" onchange="this.form.submit()" />
</form>
<?php
$path = '4.jpg';
$value = $_POST['number'];
if(!(empty($value)){
$path = explode($path,'.');
switch($value) {
case 1366:
$path = 4; //incrementing by one
break;
case 1367:
$path = 5; //incrementing by one
break;
default:
$path = 4;
break;
}
}
$path = $path.'.'.$path[1];
?>
<img class="hidden" src="<?php echo $path ?>"/>
this one uses case structure. Set as you wish.
这个使用案例结构。根据需要设置。