Jump to content

liebs19

Members
  • Posts

    50
  • Joined

  • Last visited

    Never

Everything posted by liebs19

  1. This is the working code involving only the list I was trying to populate. On the page where the list is shown: <br />Select your city: <div id="divCityList"> <select name="Cities" id="Cities"> </select> </div> In the AJAX Javascript: function stateChanged() { if (xmlHttp.readyState==4) { document.getElementById("divCityList").innerHTML=xmlHttp.responseText; } } In the PHP file called by the AJAX: //code here to connect to db and run the query echo '<select name="Cities" id="Cities">'; while ($row = mysql_fetch_array($result)) { $city = $row[City]; echo "<option value=" . $city . ">" . $city . "</option>\n"; } echo '</select>';
  2. What would the response text for this look like? Just an array with the code for the options? How would I return this array through php? This is my first AJAX script, although I am not new to javascript. When I wrote the script and it actually worked right away I was so happy. Then I tried it in IE. What is the reason to not use innerHTML? It seems so easy, and it work everywhere except IE
  3. I found a workaround for this. I had to nest my entire empty select tag inside of a div tag. Then I had to set the innerHTML of this div and echo out the start and end of the select tag as well as all of the option tags in my php script.
  4. Hi guys, I have been working on an AJAX script to populate 1 dropdown box with data from my database when selecting a value in another dropdown box. It works fine in Firefox, Opera, and Safari. However, it will not work in IE. I've been doing some google searches and I have found that IE does not like it when you return HTML data to an innerHTML statement in your AJAX responsetext. There are multiple solutions on how to fix this but none of them are for a listbox. The usually involve nesting div tags and replacing on of them. In my responsetext I am returning multiple <option></option> tags for my listbox, so I don't think that I can do this replace. has anyone come across this problem before? Do you know of a solution to make innerHTML work for a dropdown box in IE when returning HTML in the responsetext? I can post some code if needed but the code isn't the problem. The problem is getting IE to let my innerHTML work.
  5. The primary key should be used as the WHERE clause because it is guaranteed to be unique.
  6. I don't think you can do php inside of javascript. There might be a solution using AJAX, but I only know a little Ajax so I can't help you there. The php code is processed by the server before the browser ever gets the document containing the HTML and javascript.
  7. liebs19

    CSS Fill Div?

    If you wanted to make them always be 300px wide you could use div img { width:300px; height:300px; } I think that would make all images inside div tags be 300px wide and 300px high. It would make images smaller than 300px grow to that size and it would not work well for non-square images. I have not tried this but I think it should work.
  8. That query looks ok to me. Try to echo out your variables to make sure they contain what you expect.
  9. Yeah, change form.php to the location of the file you want to redirect to. It can be anywhere on you site like /forms/input/forminput.php if that is where your file is.
  10. You need to use UPDATE to edit a row. Make sure to include all fields except the id in the values. Then use the ID as the where clause to make sure you only update that 1 row.
  11. Try this: mysql_connect("localhost","root", "") or die(mysql_error()); I don't think that @localhost is needed and the mysql_error() will tell you exactly what the error is if it fails.
  12. So, instead of printing the 0 or 1 you want to print "**download the outline" or ""? If yes, what does it print when you run it with the if statement?
  13. is that code in your first post the entire block? I don't see where it prints out things like author= and outline= into that tag.
  14. Add this to your processor page: if (sizeof($_POST)==0) { header("Location:Form.php"); } else { //put the rest of your processor code here } This will redirect you to your form if no post was sent to the page, but if a post was sent it will process.
  15. Does it print and of the echo ("<sound " . ".... statement? I don't see anything wrong with the if part. What I would do is to echo out all of the $row variables that you have and make sure that what you expect to be in them is actually in them.
  16. You could store the values in a session instead of in hidden fields.
  17. Have you tried echoing out something besides a "" in the else? Then you will know if it is a problem with the compare statement or the if. Try this: $row_rsFCAG["outlineAvail"] with single quotes like this: $row_rsFCAG['outlineAvail']. I can't remember if double quotes will work in there.
  18. Do you have 2 databases or 2 tables?
  19. For that you will probably need to store the date and time that they last updated their information in the database. Also store the last login time for the user in the database. Then just compare the last information update time to the last login time for the user.
  20. I understand how to do it with everything in echo. Its is just easier for me to understand for certain things by dropping out of php. Both of them get you the same results, so one is not "better" than the other. I use both while coding. I'm not trying to argue that it is better to drop out of php. I'm simply stating that it is more important that you can read your code than which method you use.
  21. Yeah, definately you need to do whatever your team has for rules. However, when coding by yourself you should do whatever is easiest for you.
  22. I guess it is all about personal choice. I posted it this way to show that he could continue with it the way he was in his original post. I use echo when i only need to do a few lines of code out, but when it is something like a table with multiple columns or an entire form it saves me a lot of typing to drop out of php and do the straight HTML. Both will work, just do whatever one makes sense to you.
×
×
  • 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.