Jump to content

akeane

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Everything posted by akeane

  1. I don't get this. You are saying that the HTML is causing your sessions problems? The only thing I can think of is that the HTML is invalid (could be since there is no src value) and thus terminating whole process. So nothing is getting posted?
  2. So the only one that needs to be 'translated' is the item number. This should be okay than?
  3. Are they all within the same db table? If so then there would have to be a similar thing for each one? Can you give an example?
  4. What about using and associative array with the key being the word searching for? Like: $aKeywords = array('chair'=>555, 'table'=>123, 'bed'=>101, 'rug'=>350); $inWord = 'chair'; if (array_key_exists($inWord, $aKeywords)) { echo $inWord."=".$aKeywords[$inWord]; // output: chair=555 } else { echo $inWord." not found"; } WHERE $inWord is the word you want to search for and the $aKeywords[$inWord] value is the translated value you want to look for in your database.
  5. Use the idea of writing .txt file but use extension .php. Then use the .php file in an include... you will pick up any changes to the .php file.
  6. Just be careful because what I showed will destroy all the postData. Best to save each form value one at a time into sessions so you don't clear value if you don't want to. I have examples if you need it. Good Luck!
  7. Sorry I did not realize that this problem was solved (forgot to check page 2... ) before I started 'ranting'.
  8. It is my understanding that for post data you need to save them into another session value to maintain them over pages. Okay... what did I just say? Here is what I came up with (I usually set each individually but I found this in another form ): page1.php <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Page 1 - Test Session and Post</title> </head> <body> <h1>Test Session and Post</h1> <h2>Page 1 - Form</h2> <form name="theForm" action="page2.php" method="post"> <p> <label for="first">First: </label> <input class="text" type="text" name="first" id="first" size="55" value="<?=$_SESSION['formData']['first']?>" /> </p> <p> <label for="second">Second: </label> <input class="text" type="text" name="second" id="second" size="55" value="<?=$_SESSION['formData']['second']?>" /> </p> <p> <input type="submit" name="SUBMIT" value="Submit" /> </p> </form> </body> </html> page2.php <?php session_start(); $_SESSION['formData'] = $_POST; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Page 2 - Test Session and Post</title> </head> <body> <h1>Test Session and Post</h1> <h2>Page 2 - Form Poster</h2> <p> First: <?=$_SESSION['formData']['first']?> </p> <p> Second: <?=$_SESSION['formData']['second']?> </p> <p> <a href="page1.php">To Page 1</a> </p> </body> </html> The important part is in Page 2: $_SESSION['formData'] = $_POST; That will move any post date into a session variable and won't get destroyed by another post. Then you would refer to the form data as $_SESSION['formData']['first'] where 'first' is the name of an input field. You can verify this because if you run page1.php which goes to page2.php with the post data then click link to go back to page1.php you will see your original values again on page1 - now - Run page2.php and it willl show no values for First and Second. That is because there was no post data coming in. If you now click to return to page1... it also will have no values... you have just destroyed your original data. - so - In page2.php before the statement $_SESSION['formData'] = $_POST; you probably want to check to see if there is any post data before destroying any previous values: if(isset($_POST)) ... Hope I didn't confuse the issue. Simply put... You need to save the post data into your own session variable.
  9. Add an if statement: foreach ($content->find('h2') as $heading) { if ( $heading->plaintext == 'title 1' ) echo $heading; // *** ADD THIS *** }
×
×
  • 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.