Log in

View Full Version : php onclick



suji
11-24-2009, 05:31 PM
how to navigate from one html page to another using php onclick.?
i want to insert my html page data in database by submitting it at the same time after submitting it should navigate to another html page how to do this??

djr33
11-24-2009, 06:38 PM
Read this for some background information:
http://dynamicdrive.com/forums/showthread.php?t=25847

PHP is serverside and does not have any interaction with the user. Javascript has something called "onclick" but that is not part of PHP.
If you want "something to happen" when you "click", then just make a link to another PHP page and it will load.

gurmeet
11-25-2009, 06:14 AM
you can use the path of destination page into form tag like this :
<form action="destination.php">

and in the desination.php, u can write a script to submit data into database...



another way to accomplish this task is to redirect the page on destination link ... hop it l b helpful...

bluewalrus
11-25-2009, 06:54 AM
A (less secure but more to your solution) solution would be to send values in the address this can be altered by the user though so sql injections are possible and should be filtered. onclick="window.location.href ="sitename.php? + javadomainvalues"; ";

This is all in theory though. I havent tested this.