Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Missing submit button on some browsers 2

Status
Not open for further replies.

up2late

MIS
Mar 10, 2005
7
US
I've searched this forum and I've searched Google but so far I've had little luck. I have a form that has several dropdowns that are populated from a MySQL DB. All is working well. Fill in one field and it pulls the data for the next. When you get to the bottom it has a submit button to go to the next page. All works great in IE, but the submit button does not show up in Mozilla (1.4.1 Linux) or Konqueror (3.1.4-7 Linux). Those are the only browsers I've tested with so far.
If I view source I can see the code for the button.

Code:
<form name="myform" method="POST" action="placeorder.php">
  Abstractor:  <select name="agent_code" id="agent_code"><option value="">Select Abstractor...</option><br>
  <?php
    do {
  ?>
     <option value="<?php echo $row_agents['agent_code']?>"><?php echo $row_agents['fname']?> <?php echo $row_agents['lname']?></option><br>
   <?php
    } while ($row_agents = mysql_fetch_assoc($agents));
    $rows = mysql_num_rows($agents);
    if($rows > 0) {
    	mysql_data_seek($agents, 0);
    	$row_agents = mysql_fetch_assoc($agents);
    }
   ?>
   <br>
   <br>
   <input type="submit" name="post_data" value="Submit" onclick="placeorder()" /><br>
</select>
</form>

I'm sorry if this is just a noob mistake that I've missed.

Dave
 
The "</select>" tag is after the "<input>" tag for the submit button. That's illegal. IE doesn't care, but most other browsers won't process your code correctly.

Since you posted this in the PHP forum, I think your PHP code is a little bin involved to accomplish the task. Here's how I would code it:
Code:
<?
$tmp = array();
$tmp[] = '<form name="myform" method="POST" action="placeorder.php">';
$tmp[] = 'Abstractor:  <select name="agent_code" id="agent_code">';
$tmp[] = '<option value="">Select Abstractor...</option><br />';
while ($row_agents = mysql_fetch_assoc($agents));
    $tmp[] = '<option value="' . $row_agents['agent_code'] . '"> ' . $row_agents['fname'] . ' ' . $row_agents['lname'] . '</option><br />';
$tmp[] = '</select><br />';
$tmp[] = '<br />';
$tmp[] = '<input type="submit" name="post_data" value="Submit" onclick="placeorder()" /><br />';
$tmp[] = '</form>';
echo implode("\n",$tmp);
?>
Other's will probably give you other suggestions, but the gist is not to keep going in and out of PHP.

Also, submitting your code to a validator would have pointed out the problem.

YMMV

Ken
 
Thanks to both of you. That did the trick.

Ken, "a bit involved" is about the best thing anyone has said about my code. To be honest you would have to call it a rats nest and work down from there. I can't post the entire script because it could give a real programer a heart attack. This is my first project and I have no clue how to keep it organized. I'm going to try your code above and see if I can get that working, I think it may help me with another issue I was having in this script.

Thanks again
Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top