chasethemetal Posted May 27, 2011 Share Posted May 27, 2011 When clicked it sends me to my PHP page, so that works. But the data is not sent to the database. If I have a regular old submit button everything works fine. Why isnt the javascript registering as a submit with the PHP anyone know???-----<form id="myForm" action="phpurl.php" method="post"><?phprequire_once('geoplugin.class.php');$geoplugin = new geoPlugin();//locate the IP$geoplugin->locate();echo'<input name="ip" type="hidden" value="'.$geoplugin->ip.'" />'?><a href="#" onclick="document.getElementById('myForm').submit();" name="submit">submit</a><input type="submit" name="submit" value="submit" /> <!--IT WORKS FINE WHEN THE INPUT SUMBIT IS THERE, BUT I CANT USE THIS FOR MY PURPOSE. IT MUST BE ATTACHED TO AN A HREF TAG --></form>----------phpurl.php is this below$con = mysql_connect($hostname, $db_user, $db_password); mysql_select_db($database,$con); if (isset($_REQUEST['submit'])) { $sql="INSERT INTO social (ip)VALUES('$_POST[ip]')";if($result = mysql_query($sql ,$con)) { echo ' ADDED> '; } else { echo "ERROR: ".mysql_error(); } } else {} Link to comment Share on other sites More sharing options...
Ingolme Posted May 27, 2011 Share Posted May 27, 2011 I already answered your question in the Javascript forum. You don't need to post the same thread twice. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.