Pakiman1989 Posted March 1, 2014 Share Posted March 1, 2014 So I am creating a new website that allows users to click on an image and submit a form. I am using ajax so the individual doesn't have to load different page. However, I am in a small hiccup that whenever the individual hits the image and tries to submit the form, the form doesn't go through as the Ajax is blocking it. Pleae see the following: <div id="message">Click below to start searching.</div> <br> <a href='javascript:void(0);' onClick="load('content', 'm_jax.php?id=2&do=search');"><img src='map1.png' style='border: 1px solid black;' /></a> if (isset($_POST['submit'])){ echo hello; } $input = array("1", "10", "13", "123", "163","540","624"); $nb_value = 1; srand ((float) microtime() * 10000000); $random_id_length = 20; $rnd_id = crypt(uniqid(rand(),1)); $rnd_id = strip_tags(stripslashes($rnd_id)); $rnd_id = str_replace(".","",$rnd_id); $rnd_id = strrev(str_replace("/","",$rnd_id)); $rnd_id = substr($rnd_id,0,$random_id_length); $rand_keys = array_rand($input, $nb_value); $rand1=$input[$rand_keys]; $rand= mysql_query("Select * from items where id='$rand1'"); $rand1=mysql_fetch_array($rand); ?> <b>You have found an <?php echo $rand1[item];?></b> <br><br> <img src="<?php echo $rand1[id];?>.png"> <form action='' method='post'> <input type='hidden' name='value' value='12' /> <input type='hidden' name='code' value='$rnd_id ' /> <input type='submit' name='enter' value='Catch Item!'/> </form> <?php } ?> Link to comment https://forums.phpfreaks.com/topic/286642-need-help-submitting-information-on-ajax/ Share on other sites More sharing options...
Rifts Posted March 2, 2014 Share Posted March 2, 2014 wheres the ajax Link to comment https://forums.phpfreaks.com/topic/286642-need-help-submitting-information-on-ajax/#findComment-1471211 Share on other sites More sharing options...
Pakiman89 Posted March 2, 2014 Share Posted March 2, 2014 Whoops, looks like its javacript. The form isn't being submitted. Link to comment https://forums.phpfreaks.com/topic/286642-need-help-submitting-information-on-ajax/#findComment-1471227 Share on other sites More sharing options...
jazzman1 Posted March 2, 2014 Share Posted March 2, 2014 The name of the input submit element is "enter" not "submit". Did you see that? Link to comment https://forums.phpfreaks.com/topic/286642-need-help-submitting-information-on-ajax/#findComment-1471230 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.