Web Design Forum: submit button not working - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

submit button not working

#1 User is offline   gadgetgirl 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 152
  • Joined: 26-February 10
  • Reputation: 6

Posted 16 January 2012 - 12:48 PM

I'm building a holiday site which allows visitors to sign in and leave feedback about their stay. For some reason the submit button on the form isn't working. The form displays as it should but nothing happens when I click on the submit button. Any ideas?

The user has to register an account before being allowed to leave feedback so I can't direct you to the url unless you actually want to register. The code for the form is below
<form name="commentsForm" action="postCommentLH.php" method="post" >
<p><textarea name="comment" cols="50" rows="10"></textarea></p>

<?php	//form for display of calendar dropdown menu
	echo '<p id="dosForm">Date of Stay: <form>';
	calendar_dropdown();
	echo '</form></p>';
?>	
<p><input type="submit" name="submit" value=" Submit Comment " id="commentButton" /></p>
<input type="hidden" name="submitted" value="TRUE" />
</form>

The form makes use of a php function to create the calendar dropdown menu. Here's the code for that function, though I don't think that is having an effect on the submit button.
function calendar_dropdown() 
{
$months = array (1=>'January', 'February', 'March', 'April', 'May', 'June', 'July', 
'August', 'September', 'October', 'November', 'December');

echo '<select name = "month">';
foreach ($months as $key=>$value)
	{
	echo "<option value=\"$key\">$value</option>\n";
	}
echo '</select>';

echo '<select name="year">';
for ($year = 2000; $year <=2020; $year++)
	{
	echo "<option value=\"$year\">$year</option>\n";
	}
echo '</select>';
}

0

#2 User is online   brightonmike 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,996
  • Joined: 27-June 11
  • Reputation: 340
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Designer

Posted 16 January 2012 - 12:50 PM

Tried it without your calendar script?
0

#3 User is offline   gadgetgirl 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 152
  • Joined: 26-February 10
  • Reputation: 6

Posted 16 January 2012 - 01:10 PM

yes - that seems to be working now, thanks. I'm still using the calendar script, just taken out the form tags for it. Generally though - is it not ok to include a form within a form?
0

#4 User is offline   kensha 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 870
  • Joined: 12-August 10
  • Reputation: 17
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 16 January 2012 - 01:17 PM

Well the code worked when I removed the <?php //form for display of calendar dropdown menu
echo '<p id="dosForm">Date of Stay: <form>';
calendar_dropdown();
echo '</form></p>';
?>

in the middle of the form.

Then I re-posted it back and only removed <form></form tag in the echo statement and it worked.

Try to add the <?php ?> at the start and end of the form, might work it does by me.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users