[PHP] PHP subscribe by email

2005-05-16 Thread Leonie \(phpgroup\)
Does anyone know of an open source script available in php to accomplish 
the following:

A person sends an email to [EMAIL PROTECTED], the email address is 
saved to a mailing list.   I have sendMail, Apache, PHP.  Any ideas 
would be appreciated.

Cheers
Leonie
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Quickform - edit form

2005-03-09 Thread Leonie \(phpgroup\)
I've set up a form using Quickform. I've got it working a dream. My 
problem is at the moment it only adds records to the database. I would 
like to also have an edit form. I don't know what is easiest. Amend the 
existing form so it enters data and edits it, or have two different 
webpages.

Also I'm having trouble working out how to assign data to the form. Can 
anyone point me to an example?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Quickform - edit form

2005-03-09 Thread Leonie \(phpgroup\)
DID YOU TRY THIS??
?php
  echo input type=\text\ value=\$yourVariable\ /\n;
?
Look! I just assigned data to the form!

Chris.
I'm using Pear Quickform (hence my subject title) with Smarty.  The 
value needs to be assigned to the Quickform object somehow.

Creating the field with:
$form-addElement('text', 'year', 'Year:');
How do I add the value?
Leonie
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Quickform - edit form

2005-03-09 Thread Leonie \(phpgroup\)
Richard Lynch wrote:
I always go for the one form system, because otherwise you have double
the work to do (opening two files) every little change, and invariably one
of the forms drifts out of sync when (not if, when) you forget to change
the other form and...
Thanks, Robert.  I think this is the best way too.  As the app I'm 
working on is still in development no doubt the form will be changing a 
few times.


Assigning data to the form mostly consists of using the VALUE= attribute
in HTML tags, except TEXTAREA where it goes between opening/closing tag.
Basic logic flow:
?php
  if (...){ //Detect some indicator that you want a new_record
$query = insert ...;
$record_id = mysql_insert_id(...);
  }
  else{
//initialize all fields to blanks:
$name = '';
$address = '';
  }
  $record_id = isset($record_id) ? $record_id : $_REQUEST['record_id'];
  if (...){ //detect some indicator that you want to update a reocrd
 $query = update ...;
  }
  $query = select ...  where id = $record_id;
?
form action=?php echo $_SERVER['PHP_SELF']? method=post
   //form data here
/form
Yes, you display the form again with the data to edit, right after an insert.
That's by DESIGN, since it will help catch ooops! on data entry by
re-confirming with the user what they just did.  Better data entry is
good.
Thanks for that code.  It looks good.
I'm using Pear QuickForm (Pear DB for database) to create the forms, 
passing it to a Smarty template.  I'm just a bit stumped as to how to 
get the data into Quickform.

Snippet of field creation:
$form-addElement('text', 'year', 'Year:');
Leonie
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Quickform - edit form

2005-03-09 Thread Leonie \(phpgroup\)
Leonie wrote:
I've set up a form using Quickform. I've got it working a dream. My 
problem is at the moment it only adds records to the database. I would 
like to also have an edit form. I don't know what is easiest. Amend the 
existing form so it enters data and edits it, or have two different 
webpages.

Also I'm having trouble working out how to assign data to the form. Can 
anyone point me to an example?


Ahhh - got it!
Here's how to assign the value:
$date = $form-addElement('text', 'year', 'Year:');
$date-setValue('1992');
Thank you
Cheers Leonie
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Quickform - edit form

2005-03-09 Thread Leonie \(phpgroup\)
Just as a follow up.
Marek sent me a reply, but for some mysterious reason it didn't appear 
on the list:

Use either HTML_QuickForm::setDefaults() to set defaults for all 
elements or HTML_QuickForm_element::setValue() to set value for 
individual elements. Former is simpler, and if you name the forms 
elements after the table columns, you can directly pass in array 
fetched from sql query.

I've been able to fill out all the form data as follows, using PEAR DB:
//get the form data if it is an edit form
if ($_GET['id']) {
$sql = 'SELECT * FROM '.TBL_BOOK.' WHERE ID='.$_GET['id'];
$res = $db-query($sql);
$data = $res-fetchRow(DB_FETCHMODE_ASSOC);
$form-setDefaults($data);
}
As long as the fields are named the same as the table columns, this 
works well.

Thank you to everyone who helped me with this.
Leonie
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] function returning array

2003-09-07 Thread Leonie
How do I get a function to return an array?  This code doesn't work:

 function getData() {
  function builds the array  $theArray - tested ok
 return $theArray;
}

Any help on the syntax would be appreciated.

Cheers
Leonie

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] function returning array

2003-09-07 Thread Leonie
Nothing.  But it I run:

function getData() {
etc..
print_r ($theArray);
return $theArray;
}
the data is definitely there.

I should add that the function is within a class so it is like this:

class excel_com  {
(all tested - it works well)
function getData() {
etc..
return $theArray;
}
}

and here is an example of the call:

  $xls = new excel_com($workbook, $wks);
  $xls-Range($range, $inclHeader);
  $header=$xls-header;
  $data = $xls-getData();
  $xls-close();
  unset($xls);


 what do you get with this:

 $array = getData();
 print_r($array);

 -- 
 regards,
 Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Notices - Variable not defined

2003-09-05 Thread Leonie
I have this code:

 if (!$path) {
  $path = getPath();
 }

Sometimes $path is set (there are forms on the page that can change it).
When the page is first displayed:

Notice: Undefined variable: path in e:\program/  etc...
It then gives a reference to the line:   if (!$path) {

Is there a way to get rid of this annoying notice?

Cheers
Leonie

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Notices - Variable not defined

2003-09-05 Thread Leonie
Wow!  That's service!  Thank you.

Leonie

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Planning a project with PHP.

2003-09-05 Thread Leonie
Have you checked out the code libraries at PEAR?

It is all OO and includes templates for separating code from presentation.
I think its pretty cool.

http://www.pear.php.net/

You might also like to check this out with the folks at another forum on
news.php.net:
php.pear.general

I think you will find what you are looking for there.

Regards
Leonie

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Copy database from MySQL to MSAccess

2003-09-02 Thread Leonie
Hi Kjell

I'm not sure whether you are transferring from within the webserver, or from
the webserver to MS locally, but either way I'd set up the MS database
locally.  Just install the MySQL ODBC driver (I think its at the mysql.com
website) and link all the MySQL tables to your MS Access database and just
import the tables using the processes within Access itself.

Afterwards you can transfer the Access database up to the server.

If you are doing the database functions wholly within the server you might
consider using the Pear DB database abstraction layer to make it simplier.
(That's how I'd do it anyway).

Cheers
Leonie

Kjell Hansen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi there,
 I'd like to have a template DB stored with MySQL from which I later can
 create clientDB's for use with MSAccess.
 I've read that I can connect to MSAccess with PHP through ODBC and that's
 fine but how do I transfer the tables and cusomized data?

 TIA
 /Kjell Hansen

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php