How to insert the information when we click on the image

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pavithra
Forum Newbie
Posts: 1
Joined: Tue Oct 12, 2010 2:22 am

How to insert the information when we click on the image

Post by pavithra »

Please anyone help me. i have created 4 tables. in front end i have 4 image specifying the type . if i click that image it should save in database. that field is in all the four tables in the database by name register type. how shall i do it using javascript and php. please anyone guide my :(

Thanks in advance...............
User avatar
iijb
Forum Commoner
Posts: 43
Joined: Wed Nov 26, 2008 11:34 pm

Re: How to insert the information when we click on the image

Post by iijb »

Hi
Could you give more details about your problem.
I think you can done it by including in the url .
<a href="insert.php?imagetype=yourtype"><img src="image.jpg" /></a>

In insert.php get the value by $_GET['imagetype'] and save it your database

Regards
iijb
kalpesh.mahida
Forum Commoner
Posts: 36
Joined: Wed Oct 06, 2010 7:09 am

Re: How to insert the information when we click on the image

Post by kalpesh.mahida »

Hi,

If you want to store info of type of register account along with some other fields of your registration form you can make use of four submit button. You can apply the images to submit buttons using CSS and after successfull submit of the form you can check which submit button was pressed while submitting regristration data to server.

Bellow is Html part of the page.

<form name="frmSubmitTest" id="frmSubmitTest" action="buttons.php" method="POST">
<input type="text" name="firstname" id="firstname" />
<input type="submit" value="Submit1" name="Submit1" />
<input type="submit" value="Submit2" name="Submit2" />
<input type="submit" value="Submit3" name="Submit3" />
<input type="submit" value="Submit4" name="Submit4" />
</form>

buttons.php
print_r($_POST);

I think you are looking for something like described above. If this is not you are looking for please explain your problem with more details.
Hope this will help you,

Kalpesh Mahida
Post Reply