Jump to content

PHPorbust

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

PHPorbust's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you. The Div solution works. There appears to be also an innerhtml=outerhtml solution as well that works. Appreciate the puzzle solving skills.
  2. Hi there Ivan, The rest of the AJAX part is the standard, similar to what you posted, indeed. The POST is the "Select" choice being sent to a processing page unrelated to the AJAX call. Everything is good in Firefox, Safari. I have it down to the issue being an IE bug that exists with innerhtml used in <Select>. It is documented by Microsoft in fact. But their solution eludes me
  3. Hi, It appears I ran into the dreaded IE <select> issue with innerhtml. I have looked at multiple solutions but alas I reach out for help! The code works beautifully in Safari and Firefox but fails in IE by simply loading blanks when AJAX is called. I read up on microsoft.com a DIV may work outside the <select>. But I must be messing something up. Thanks for your puzzle solving help! Code: AJAX: xmlHttp.onreadystatechange=function(){ if(xmlHttp.readyState==4) { var temp=(xmlHttp.responseText); document.getElementById("option").innerHTML=temp; } } var queryString = "?page=" + page; xmlHttp.open("GET","AJAX_page.php" + queryString,true); xmlHttp.send(null); PHP: <?php echo "<form action='next.php' method='POST'>"; echo "<select name='id' id='option'><option value=0>Option_0/option>"; { echo "<option value ='$id'>$choice</option>"; } echo "</select>"; echo "<input type='submit' value='Submit'></form>"; ?>
  4. What did you expect exactly? No other errors at all that I can see .
  5. Here you go.... Query: SELECT * FROM business WHERE ID = Produced error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
  6. $extract2 = mysql_query($q2) or die('<br>Query:'.$q2.'<br>Produced error:'.mysql_error()'); = Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /***/search.php on line +2
  7. I do get this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 when I use: $extract2 = mysql_query($q2) or die(mysql_error());
  8. $extract2 = mysql_query($q2) or die('<br>Query:'.$q2.'<br>Produced error:'mysql_error()'); = Parse error: syntax error, unexpected T_STRING in /***/search.php on line
  9. Getting an intermittent error...ughh challenging Overview: I am trying to use a drop down menu populated from a mySql database. Once the choice is selected it redirects to a php index page that uses if/else to redirect the page. If it works correctly the redirect is back to the original page but now contains the POST ID associated with the user's choice which goes to another mySQL query and returns the echo'd results. Problem is, sometimes this works and sometimes I get an error. It always works the first time. When it does error and I echo the ID, it is blank. I can reselect the same choice or a different one and sometimes it works, sometimes not. Any help would be appreciated. IE Error:Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /html/includes/search.php on line search.php: <?php require("connect.php"); //extract data mySQL $extract = mysql_query("SELECT * FROM business ORDER BY id ASC"); echo "<form action ='index.php?page=search' method='POST'>"; echo "<select name='id'>"; while ($row = mysql_fetch_assoc($extract)) { $id = $row['id']; $grocery = $row[‘grocery']; echo "<option value ='$id'>$grocery</option>"; } echo "</select>"; echo "<input type ='submit' value='submit'></form>"; ?> <?php //extract data mySQL $q2 = "SELECT * FROM business WHERE ID = $_POST[id]"; $extract2 = mysql_query($q2); $result2 = mysql_fetch_array($extract2); $groc2 = $result2[‘grocery']; $fru2 = $result2[‘fruit']; ?> Here is the php index page that directs: ?php include("includes/header.html"); include("includes/navbar.html"); if($_GET['page'] == "stores"){ include("includes/stores.php"); }else if($_GET['page'] == "search"){ include("includes/search.php"); }else if($_GET['page'] == "toys"){ include("includes/toys.html"); }else{ include("includes/home.html"); } include("includes/footer.html"); ?>
  10. Your code is nicer And it appears my code actually works too! I actually did have the .txt files in the wrong directory. I must have staired at it for hours not noticing. Doooh! Thanks Zach for optimizing!
  11. Hi, I wrote this to retrieve a file based on a POST value. For some reason it will not retrieve the file content and display it at all. I get this message: Warning: fopen(18.txt) [function.fopen]: failed to open stream: No such file or directory in /home/content/x/y/z/path/html/includes/different.php The 18 is the correct POST value. So that is a positive There is a file named 18.txt in /home/content/x/y/z/path/html/includes/18.txt Thanks. <?php $id5 = $_POST[id]; //Display Text File $myFile = $id5; $myFile .= ".txt"; $fh = fopen($myFile, 'r'); $theData = fgets($fh); fclose($fh); echo $theData; ?>
×
×
  • 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.