[Solved *whew*] "Saving" a list
Posted: Tue Oct 12, 2004 8:28 pm
I have a list of words taken from mysql. Now, I'd like to give the user the option to "save" the list, where it emails them the list as well as updates in in the database.
I've tried a million different ways and they all do what I don't want them to. Let me explain:
The words come up like so:
"Save List as Today's" is a link: wordlist.php?do=savelist. When that is clicked, I'd like to update the DB, email, all that without the list refreshing. Here's my code:
But the list always changes/refreshes, then stored in the session variable. I just need it to store the current list in the session. Hope this makes sense 
I've tried a million different ways and they all do what I don't want them to. Let me explain:
The words come up like so:
Code: Select all
69654) Neuroanatomy
26444) Cauline
76930) Phoneticism
68923) Nailless
23968) Buchu
82004) Puggy
72758) Outcharm
16904) Aperient
14058) Adhere
29330) Coasting
Total: 39 points
Minimum Length <input field here>
Maximum Length <input field here>
# of Words: <input field here>
Save List as Today'sCode: Select all
$_SESSION['words'] = array();
$total = 0;
if(empty($_SESSION['words'])){
$getWords = mysql_query("SELECT word, id, LENGTH(word) AS len FROM all_words WHERE LENGTH(word) > $min AND LENGTH(word) < $max ORDER BY RAND() LIMIT 0, $limit");
while($r = mysql_fetch_assoc($getWords)){
$today[] = $r['word'];
$total += $r['len'];
//display code removed... just echoing <tr>, <td> etc...
}
if(isset($_GET['do']) && $_GET['do'] == 'savelist'){
foreach($today as $todo){
$_SESSION['words'][] = $todo;
}
}
}