尝试使用图像将变量保存到MYSQL数据库表 [英] Trying to save variables to a MYSQL database table using images

查看:48
本文介绍了尝试使用图像将变量保存到MYSQL数据库表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我不确定如何问这个问题...但是我正在建立一个网站,您可以在该网站中单击六个天气图标之一,将您带到一个可以输入名称的页面以及与天气有关的故事,并将其与其他人关于同一类型天气的故事一起发布在最后一页.我设置了一个表格来保存名称和故事,但是当用户单击其中一个图标时,我不确定如何保存天气.

So I'm not really sure how to ask this...but I'm making a website in which you would be able to click one of six weather icons leading you to a page that will allow you to enter your name and a story relating to the weather and post it on a final page with other peoples stories about the same type of weather. I have a table set up to save the name and story, but I'm not sure how to save the weather when a user click on one of the icons.

我的老师说要用javascript做某事,并制作一个隐藏的表格或其他东西.如果可以的话,请点击这里到网站的链接. http://www.tcnjart.com/christineaustin/whethertheweather/index.html

My teacher was saying to do something with javascript and making a hidden form or something. Heres the link to the site if that would help. http://www.tcnjart.com/christineaustin/whethertheweather/index.html

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>WhethertheWeather.</title>

<!--<link rel="stylesheet" type="text/css" href="demo/css/screen.css" media="all" />-->
    <script src="http://www.adrianpelletier.com/mint/?js" type="text/javascript">           
 </script>
    <script type="text/javascript" src="demo/scripts/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="demo/scripts/jquery-ui-1.7.1.custom.min.js">      
 </script>
    <script type="text/javascript" src="demo/scripts/execute.js"></script>


 <script>
     function connect(){
var moveto= $.(#sel).attr("name");
$(#myweather).value=moveto;
myform.submit;

}

</script>

<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body background="images/gradientsky.jpg"> 

 <div id="logo">

WhethertheWeather.

</div>

<div id="question">

Whats your favorite weather?

</div>

<div id="weather">

<ul id="nav-reflection">
<form name="myform" method="post" action="cloudy_name.php">
    <li class="button-color-1"><a href="javascript:connect();"id="sel"name"cloudy"       
 title="My fancy link"><img src="images/cloudybubble.png" width="211" height="180"align="left">  
</a></li>
<li class="button-color-1"><a href="sunny_name.php" title="My fancy link"><img               src="images/sunnybubble.png" width="211" height="180" align="left"></a></li>
<li class="button-color-2"><a href="snowy_name.php" title="My fancy link"><img src="images/snowbubble.png" width="211" height="180" align="left"></a></li>
<li class="button-color-1"><a href="snowy_name.php" title="My fancy link"><img src="images/rainbubble.png" width="211" height="180" align="left"></a></li>
<li class="button-color-1"><a href="mixy_name.php" title="My fancy link"><img src="images/mixbubble.png" width="211" height="180" align="left"></a></li>
<li class="button-color-1"><a href="windy_name.php" title="My fancy link"<imgsrc="images/windybubble.png" width="211" height="180" align="left"></a></li>

<input type="hidden" name="weather" value="none" id="myweather">
</form>
</ul>
</div>

</body>
</html>

推荐答案

首先,本作业的重点是让您自己确定如何完成此操作,尽管我猜想是 kindof 计入这一点.

Well, first of all, the point of this homework is for you to figure out how to do this on your own, although I guess SO kindof counts towards that.

设置图像的onclick属性,设置隐藏表单元素的值.这应该足以让您谷歌搜索并获得正确的答案.

Set an onclick property of the image set the value of a hidden form element. That should be enough for you to google and get a proper answer.

<img src=foo onclick="javascript_code_goes_here">

<input type=hidden name='weather' id='weather' value=''>

这篇关于尝试使用图像将变量保存到MYSQL数据库表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆