Jump to content

Form Help


timmah1

Recommended Posts

I have a form that people can fill out, it has a drop-down with different options, if their option isn't listed, they can click on a link and a pop-up pops up, they can enter their

option, click on submit, and it automatically refreshes the drop-down with all values, including the new one.

It works great with Firefox, but not IE.

 

In IE, it makes the drop-down go blank.

 

Here is the code

The link for the pop-up

<span class="style1">Job Type Not Listed?<br /><a href="javascript:loadWindow('pop_job_type.php');">Click Here</a></span>

 

The form for putting new info into

<script type="text/javascript">
function update(){
var vals = opener.document.form1.general_contractor.innerHTML;
var newVal = document.getElementById('name').value;
var finalVal = vals+'<option value="'+newVal+'">'+newVal+'</option>';
opener.document.form1.general_contractor.innerHTML = finalVal;
document.theForm.submit();
}
</script>
<?php

if($_POST['enter'] == "yes"){
include("config.php");
$insert = mysql_query("insert into contractors values ('NULL','".$_POST["name"]."','".$_POST["address"]."','".$_POST["office"]."','".$_POST["cell"]."','".$_POST["contact"]."','".$_POST["email"]."','".$_POST["type"]."')")
or die("Sorry, there was a problem inserting contractor ".mysql_error());

echo "Contractor inserted into database";
?>

<br /><a href="javascript:window.close()" onclick="update();">Close This Window</a>


<?php
}
else {


?>
<form action="#" method="POST">
<h1>New Contractor</h1>
This is where you will input a new contractor.
<table cellspacing="0" cellpadding="5">

  <tr>
    <td>Contractor Name</td>
    <td><input type="text" name="name" id="name"></td>
  </tr>
  <tr>
    <td>Contractor Address</td>
    <td><textarea name="address" id="address"></textarea></td>
  </tr>
  <tr>
    <td>Contractor Office</td>
    <td><input type="text" name="office" id="office" /></td>
  </tr>
  <tr>
    <td>Contact Cell</td>
    <td><input type="text" name="cell" id="cell" /></td>
  </tr>
  <tr>
    <td>Contact Name</td>
    <td><input type="text" name="contact" id="contact" /></td>
  </tr>
  <tr>
    <td>Contact Email</td>
    <td><input type="text" name="email" id="email" /></td>
  </tr>
  <tr>
    <td>Contractor Type</td>
    <td><select name="type" id="type">
      <option value="General">General</option>
    </select>
    </td>
  </tr>
  <tr>
    <td> </td>
    <td><input type="hidden" name="enter" id="enter" value="yes" />
        <input type="submit" name="button" id="button" value="Submit" onclick="update();" /></td>
  </tr>
</table>
</form>
<?php
}
?>

 

Any ideas on how I can fix this?

 

Thanks in advance

 

Link to comment
Share on other sites

ya know

 

Holy.  Crap.  I beg of you people to put OR die(mysql_error()) after your queries so you can see what's going on. =/

 

/\ Not everyone uses mysql and not all the other database have that function.. like mssql for instance

Link to comment
Share on other sites

are you sure your name is not literal lucy??

 

don't you think its obvious that we know that you know that this is an IE bug..?

 

hence you posting it to be an IE bug..?

 

all i'm sayin is hey i made a comment about your sig... whoopie frikin do man..

 

and you decided you would be an arse about it.. hence my being arse back to you telling you the fix is that there is not a fix because its an IE bug..

 

I was going to attempt to solve your problem but I see now that you do not want my help therefore I will be the better person and refrain from posting in this topic..

 

I said good day sir!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.