通过单击图像保存变量 [英] Saving a variable through clicking an image
问题描述
我一直在为此奋斗一段时间,仍然无法找到答案。在我的网页上,我有6种不同的天气照片。当用户点击一个时,我想让它做两件事 -
1)将一个变量保存到一个表格中(例如 - 按阴天图片,'阴天' 2)它会将你重定向到下一页(在这个页面中你将输入一个名字,然后提交给你)表格,它会将你重定向到另一个页面,你将提交一个与天气有关的故事)。因此,这些信息将全部张贴在一张表格上人们可以看到。但我的主要问题是我不能得到天气变量保存到数据库表,并重定向到下一页,任何人都知道的方式?
这是两个代码代码我试图找出一些帮助。
和
如果您使用
< input type =imagesrc =cloudy.pngalt =多云name =weathervalue =cloudy>
然后图像将会(大部分)与表单提交按钮具有相同的名称/值。根本不需要JavaScript。
I've been struggling with this for sometime now and still cant seem to find and answer. On my webpage I have 6 different individual pictures of weather. When the user clicks one, I want it to do two things-
1) Save a variable to a table (Ex- You press the cloudy picture, 'cloudy' is saved to my table under the 'weather' colomn)
2) It will redirect you to the next page (in this page you will enter a name, then submit that to the table and it will redirect you to another page where you will submit a story relating to the weather)
As a result, this information will all be posted on a form that people can see. But my main issue is i cant get the weather variable to save to the database table AND redirect you to the next page, anyone know of a way?
Here are two codes code I had some help on trying to figure out.
and
If you use an
<input type="image" src="cloudy.png" alt="Cloudy" name="weather" value="cloudy">
then the image will act (mostly) the same as a form submit button would with the same name/value. No javascript needed at all.
这篇关于通过单击图像保存变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!