Reputation: 93
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
Upvotes: 0
Views: 141
Reputation: 138200
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.
Upvotes: 1