Thread View: adobe.golive.dynamic.content
3 messages
3 total messages
Started by Jeremy_M._Cox
Thu, 15 Jul 2004 20:53
NateMail and Dynamic Recipients
Author: Jeremy_M._Cox
Date: Thu, 15 Jul 2004 20:53
Date: Thu, 15 Jul 2004 20:53
9 lines
1737 bytes
1737 bytes
Has anyone been able or even tried to make the recipients in the ProcessForm or NateMail script dynamic. Nate said it could be done but he isn't sure exactly how to do it in GoLive because of the way GoLive writes the code. I have a table of personnel which includes a field for email address. I want a dynamically created drop menu of email address from the table to allow the user to only select a working email address. I have named the drop menu "recipient" instead of using a hidden field. The value of the menu selection is the primary key for the table. Now in the script of ProcessForm or NateMail I have to make the $recipient[i] generate all the working email address. "i" would be the primary key passed by the drop menu. The other side of the equals sign should be I think, the name of the recipient or I guess it makes sense to put the email address that corresponds with the primary key passed by the drop menu. Is this right? Am I doing this right. Do I have to copy and paste golive php code into the ProcessForm or NateMail Script? Anyway thanks in advance. Jeremy Cox
Re: NateMail and Dynamic Recipients
Author: Jeremy_M._Cox
Date: Sun, 18 Jul 2004 17:24
Date: Sun, 18 Jul 2004 17:24
41 lines
1941 bytes
1941 bytes
I added a db connect and query at the top of the script to pull out the IDs and email address from the db. Keep getting a parsing error.
Here is the script I added to the top of the page inside the php open tag.
require_once("../config/include/db_fns.php")
$conn = db_connect();
if (!$conn)
return 'Could not connect to database server - please try later.';
mysql_select_db('tqeg');
$query = "select personnel_ID, personnel_email from personnell";
$result = mysql_query ($query);
$num_results = mysql_num_rows($result);
I then placed this inside the recipient line
for ($i=0; $i <$num_results; $i++) {
$row = mysql_fetch_array($result);
$thisID =
$recipients[htmlspecialchars(stripslashes($row['personnel_ID']))] = stripslashes($row['personnel_email']);
}
can someone look at this and tell me if its wrong? Would this even work in the ProcessForm script at all?
Here is the db_fns.php file from the require
< ?php function db_connect() { $db = mysql_pconnect('localhost', 'username', 'password'); if (!$db) return false; } ? >
I get a parse error on line 5 in the process form script.
This is the line 5
$conn = db_connect();
I got rid of the this code block which is:
$conn = db_connect();
if (!$conn)
return 'Could not connect to database server - please try later.';
and I still get a parse error.
Re: NateMail and Dynamic Recipients
Author: Jeremy_M._Cox
Date: Sun, 18 Jul 2004 18:30
Date: Sun, 18 Jul 2004 18:30
1 lines
676 bytes
676 bytes
Whooo hoooo I got it to work.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads