php - Second form on page is using first form's action attribute -
i have page 2 forms, , sec form using action attribute of first form. code:
<!-- mount sites --> <form name="form" action="shopsite.php" method="post" id="form"> <!-- sites pass alt tag shopsite.php --> <ul id="sites"> <tr> <li><td class="" id="hyland"><div><img id="imghyland" onclick="this.src='radiotower.jpg';clearack('hyland');" src="radiotower.jpg" alt="hyland" class="location" /><br/>hyland</div></td></li> </ul> <div><input type="hidden" name="sitename" id="sitename" value="" /></div> </form><!-- end first form --> <!-- non-mountain sites --> <form name="form-nm" action="shopsite-nm.php" method="post" id="form-nm"> <!-- sites pass alt tag shopsite-nm.php --> <ul id="sites"> <li><td class="" id="kms"><div><img id="imgkms" onclick="this.src='radiotower.jpg';clearack('kms');" src="radiotower.jpg" alt="kms" class="location" /><br/>kms</div></td></li> </tr> <div><input type="hidden" name="sitename" id="sitename" value="" /></div> </form><!-- end sec form -->
when click input on either form (inputs li tags), goes shopsite.php. inputs in sec form should go shopsite-nm.php. researched using multiple forms on page phone call different php pages, , supposedly it's possible, although illustration found did not utilize hidden input. i'm not sure if problem.
thanks in advance help :)
edit: sitename passing correctly both forms.
edit 2: if there's improve way build this, i'm open suggestions. thought each form displays list of sites status, , when user clicks on site, shown page more detailed info particular site. there 1 form sites, new sites have been added require different informational display, i'm trying accommodate sec form.
could utilize jquery here?
$(document).ready(function() { $('#hyland').click(function(e) { $.ajax({ url: 'shopsite.php', type: 'post', data: $('#form').serialize(), success: function(res) { //do here console.log(res); }, error: function(error) { //do here console.log(res); } }); }); });
php html forms
No comments:
Post a Comment