Test

Lists: pgsql-php
From: Chadwick Rolfs <c2304182(at)webdevel(dot)urban(dot)csuohio(dot)edu>
To: <pgsql-php(at)postgresql(dot)org>
Subject: Test
Date: 2001-06-13 19:11:08
Message-ID: Pine.LNX.4.33.0106131509580.13453-100000@webdevel.urban.csuohio.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

I can't seem to post to this list that I keep recieving e-mail from. I
want to parse a web form through php and put it into a postgresql
batabase. Who can help? or point me toward the right direction...
thanks.

Chadwick Rolfs


From: "Adam Lang" <aalang(at)rutgersinsurance(dot)com>
To: <pgsql-php(at)postgresql(dot)org>
Subject: Re: Test
Date: 2001-06-13 20:35:22
Message-ID: 00ac01c0f448eb4be200a0a0a@rutgersinsurance.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

For starters, you need to clarify hat you mean by "parsing a web form". Do
you mean getting the information that has been inputted, or taking the form
and parsing the html in it?

If it is the former and you want to get the info and put it into a database,
you should start out by reading some documentation and/or getting a PHP
programming book.

This is pretty standard stuff for PHP and if you don't even know where to
start, you should do some reading first.

Your best friend will be www.php.net.
For postgresql connectivity, go there and search on pg_connect. It should
bring up the relevant functions.

Also make sure you have postgres support compiled into your PHP module.

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
http://www.rutgersinsurance.com
----- Original Message -----
From: "Chadwick Rolfs" <c2304182(at)webdevel(dot)urban(dot)csuohio(dot)edu>
To: <pgsql-php(at)postgresql(dot)org>
Sent: Wednesday, June 13, 2001 3:11 PM
Subject: [PHP] Test

> I can't seem to post to this list that I keep recieving e-mail from. I
> want to parse a web form through php and put it into a postgresql
> batabase. Who can help? or point me toward the right direction...
> thanks.
>
> Chadwick Rolfs
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html


From: Chadwick Rolfs <c2304182(at)webdevel(dot)urban(dot)csuohio(dot)edu>
To: Adam Lang <aalang(at)rutgersinsurance(dot)com>
Cc: <pgsql-php(at)postgresql(dot)org>
Subject: Re: Test
Date: 2001-06-13 21:38:30
Message-ID: Pine.LNX.4.33.0106131732150.13453-100000@webdevel.urban.csuohio.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

Well, thank you very much. I hope that's not sarcasm I detect in this
effort to educate the newbies. I should mention that I am a newbie, I am
constantly reading the documentation, and that I KNOW WHERE TO START.
Here. I got to this list from postgresql.org, and the php lists are tough
to navigate (ie, i recieve, but can't seem to consistently post.)

Maybe, since you seem to be "in the know", you can point out one of the
pgsql/php functions you have mentioned instead of giving me useless
information. That would help...
If you look closely, you'll see that there is a problem, there is really
no function that takes web form contents (yes the name=value pairs, not
the html tags (w3.org can do that!)) and puts these into :

insert into <table_name> ($web_form_names) values ($web_form_values);

Is there anyoneELSE out there who can HELP me? or give me some sort of
constructive advice, instead of making me feel like I'm doing something
horribly wrong, like adam here....

Chadwick Rolfs

On Wed, 13 Jun 2001, Adam Lang wrote:

> For starters, you need to clarify hat you mean by "parsing a web form". Do
> you mean getting the information that has been inputted, or taking the form
> and parsing the html in it?
>
> If it is the former and you want to get the info and put it into a database,
> you should start out by reading some documentation and/or getting a PHP
> programming book.
>
> This is pretty standard stuff for PHP and if you don't even know where to
> start, you should do some reading first.
>
> Your best friend will be www.php.net.
> For postgresql connectivity, go there and search on pg_connect. It should
> bring up the relevant functions.
>
> Also make sure you have postgres support compiled into your PHP module.
>
>
> Adam Lang
> Systems Engineer
> Rutgers Casualty Insurance Company
> http://www.rutgersinsurance.com
> ----- Original Message -----
> From: "Chadwick Rolfs" <c2304182(at)webdevel(dot)urban(dot)csuohio(dot)edu>
> To: <pgsql-php(at)postgresql(dot)org>
> Sent: Wednesday, June 13, 2001 3:11 PM
> Subject: [PHP] Test
>
>
> > I can't seem to post to this list that I keep recieving e-mail from. I
> > want to parse a web form through php and put it into a postgresql
> > batabase. Who can help? or point me toward the right direction...
> > thanks.
> >
> > Chadwick Rolfs
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/users-lounge/docs/faq.html
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>


From: Chris Smith <csmith(at)squiz(dot)net>
To: <pgsql-php(at)postgresql(dot)org>
Subject: Re: Test
Date: 2001-06-13 22:49:35
Message-ID: 4.3.2.7.2.20010614084104.02228530@cooee.cybersydney.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

Hi,

>Well, thank you very much. I hope that's not sarcasm I detect in this
>effort to educate the newbies. I should mention that I am a newbie, I am
>constantly reading the documentation, and that I KNOW WHERE TO START.
>Here. I got to this list from postgresql.org, and the php lists are tough
>to navigate (ie, i recieve, but can't seem to consistently post.)

I don't think that was his intention at all. There is no "one" place to
start, it depends on your goals for using php. If you want to use php for
sending emails via contact forms, that's totally different to anything
database related, which it totally unrelated to using filesystem functions,
so it's a bit hard to give you one starting point.

>Maybe, since you seem to be "in the know", you can point out one of the
>pgsql/php functions you have mentioned instead of giving me useless
>information. That would help...

http://www.php.net/manual/en/ref.pgsql.php <-- gives you all the postgresql
functions for using it with php. eg, how to connect, how to perform the
queries etc.

>If you look closely, you'll see that there is a problem, there is really
>no function that takes web form contents (yes the name=value pairs, not
>the html tags (w3.org can do that!)) and puts these into :
>
>insert into <table_name> ($web_form_names) values ($web_form_values);

Nope, you'll either have to create a function to do it yourself, or write
it by hand (probably the latter is better, you never have a consistent
number of fields etc on forms so a function would quickly become out of
control & thus useless).

I've got a small tutorial (shameless plug :P) which might give you some
starting points. It's a little outdated, haven't got around to updating it
yet (it's just using older versions of the software, everything else should
be fine) --> http://designmagick.50megs.com/postgresql-tutorial/ or if that
doesn't work, it's mirrored at
http://www.newbienetwork.net/sections.php?op=listarticles&secid=5 .

If you have any specific questions in mind, then feel free to ask :)

HTH

----------------------
Chris Smith
http://www.squiz.net/


From: GH <grasshacker(at)over-yonder(dot)net>
To: Chadwick Rolfs <c2304182(at)webdevel(dot)urban(dot)csuohio(dot)edu>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: Test
Date: 2001-06-13 22:52:06
Message-ID: 20010613175206.A18199@over-yonder.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

On Wed, Jun 13, 2001 at 05:38:30PM -0400, some SMTP stream spewed forth:
> Well, thank you very much. I hope that's not sarcasm I detect in this
> effort to educate the newbies. I should mention that I am a newbie, I am
> constantly reading the documentation, and that I KNOW WHERE TO START.
> Here. I got to this list from postgresql.org, and the php lists are tough
> to navigate (ie, i recieve, but can't seem to consistently post.)

This very much is sarcasm, but I think you deserve it. *shrug*.

You want to do something using PHP. I suppose that means you want
Documentation. PHP probably has some documentation up on its website, eh?
< www.php.net >. On the first page is a link to (*boggle*) documentation.
Function documentation would probably be in the manual.
Ah, there we go, "Function Reference". Hm...PostgreSQL Functions...(*boing*).

> Maybe, since you seem to be "in the know", you can point out one of the
> pgsql/php functions you have mentioned instead of giving me useless
> information. That would help...

This is a really basic use of PHP<->PostgreSQL...you would best be served
by a book (or online tutorial). It is not the duty of this list to tutor.

> If you look closely, you'll see that there is a problem, there is really
> no function that takes web form contents (yes the name=value pairs, not
> the html tags (w3.org can do that!)) and puts these into :

Of course not, such a thing would be silly.

> insert into <table_name> ($web_form_names) values ($web_form_values);
>
> Is there anyoneELSE out there who can HELP me? or give me some sort of
> constructive advice, instead of making me feel like I'm doing something
> horribly wrong, like adam here....

Depending on the settings in php.conf global variables may or may not be
set from form input. One of the following should work to get the value of
<input name="variable"...>:

$variable
$GLOBALS['variable']
$HTTP_POST_VARS['variable']
$HTTP_GET_VARS['variable']

You must first establish a connection to the PostgreSQL server:
$link=pg_connect('host=<host or do not specify for localhost> user=<user>
password=<password> dbname=<database name> port=5432');
Then, insert the values using a standard insert query:
pg_exec($link, 'insert into <table> values (\''.$variable.'\')');
which executies the query:
insert into <table> values ('$variable');

> Chadwick Rolfs
>
*snip Adam's message*
> > Your best friend will be www.php.net.

Always a good idea, eh? ;-)
(Chadwick: you can do this by using the php function phpinfo(););

Try not to be so pleasant when asking other people to take time to help
you. As far as I know, none of us get paid to be here (which shouldn't
really matter anyway, you can't expect f****** magic all the time.

gh

> > Adam Lang
> > ----- Original Message -----
> > From: "Chadwick Rolfs" <c2304182(at)webdevel(dot)urban(dot)csuohio(dot)edu>
> > > I can't seem to post to this list that I keep recieving e-mail from. I
> > > want to parse a web form through php and put it into a postgresql
> > > batabase. Who can help? or point me toward the right direction...
> > > thanks.
> > > Chadwick Rolfs


From: "mike" <mike(at)partner2partner(dot)com>
To: Chadwick Rolfs <c2304182(at)webdevel(dot)urban(dot)csuohio(dot)edu>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: Test
Date: 2001-06-13 23:04:48
Message-ID: 20010613230448.17922.qmail@conan.partner2partner.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

I agree with Adam that the annotated manuals at www.php.net are the
authoritative source for information on how to do what you want to do.
Unfortunately, you will have to do some homework to come up to speed on how
this process works. There is no function that does everything you want for
you in any language that I'm aware of. If you find one let me know!

We use the ADODB library (http://php.weblogs.com/ADODB) which provides
database abstraction for many databases including PostgreSQL. I recommend
it highly.

The data from the form is returned to PHP as a variable with the same name
as the name in the form. The value of this variable is the result returned
by the form. Therefore, your code example of "insert into <table_name>
($web_form_names) values ($web_form_values);" is indeed accurate.

I suggest you download an open source package and see how it is doing this
process. There are many of them available on either www.greatbridge.org or
www.sourceforge.net or www.freshmeat.net or ...

Michael J. Upchurch
Partner2Partner Communications mike(at)partner2partner(dot)com 615.286.2199

Chadwick Rolfs writes:

> Well, thank you very much. I hope that's not sarcasm I detect in this
> effort to educate the newbies. I should mention that I am a newbie, I am
> constantly reading the documentation, and that I KNOW WHERE TO START.
> Here. I got to this list from postgresql.org, and the php lists are tough
> to navigate (ie, i recieve, but can't seem to consistently post.)
>
> Maybe, since you seem to be "in the know", you can point out one of the
> pgsql/php functions you have mentioned instead of giving me useless
> information. That would help...
> If you look closely, you'll see that there is a problem, there is really
> no function that takes web form contents (yes the name=value pairs, not
> the html tags (w3.org can do that!)) and puts these into :
>
> insert into <table_name> ($web_form_names) values ($web_form_values);
>
> Is there anyoneELSE out there who can HELP me? or give me some sort of
> constructive advice, instead of making me feel like I'm doing something
> horribly wrong, like adam here....
>
> Chadwick Rolfs
>
> On Wed, 13 Jun 2001, Adam Lang wrote:
>
>> For starters, you need to clarify hat you mean by "parsing a web form". Do
>> you mean getting the information that has been inputted, or taking the form
>> and parsing the html in it?
>>
>> If it is the former and you want to get the info and put it into a database,
>> you should start out by reading some documentation and/or getting a PHP
>> programming book.
>>
>> This is pretty standard stuff for PHP and if you don't even know where to
>> start, you should do some reading first.
>>
>> Your best friend will be www.php.net.
>> For postgresql connectivity, go there and search on pg_connect. It should
>> bring up the relevant functions.
>>
>> Also make sure you have postgres support compiled into your PHP module.
>>
>>
>> Adam Lang
>> Systems Engineer
>> Rutgers Casualty Insurance Company
>> http://www.rutgersinsurance.com
>> ----- Original Message -----
>> From: "Chadwick Rolfs" <c2304182(at)webdevel(dot)urban(dot)csuohio(dot)edu>
>> To: <pgsql-php(at)postgresql(dot)org>
>> Sent: Wednesday, June 13, 2001 3:11 PM
>> Subject: [PHP] Test
>>
>>
>> > I can't seem to post to this list that I keep recieving e-mail from. I
>> > want to parse a web form through php and put it into a postgresql
>> > batabase. Who can help? or point me toward the right direction...
>> > thanks.
>> >
>> > Chadwick Rolfs
>> >
>> >
>> > ---------------------------(end of broadcast)---------------------------
>> > TIP 5: Have you checked our extensive FAQ?
>> >
>> > http://www.postgresql.org/users-lounge/docs/faq.html
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 5: Have you checked our extensive FAQ?
>>
>> http://www.postgresql.org/users-lounge/docs/faq.html
>>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster


From: "Adam Lang" <aalang(at)rutgersinsurance(dot)com>
To:
Cc: <pgsql-php(at)postgresql(dot)org>
Subject: Re: Test
Date: 2001-06-14 13:44:39
Message-ID: 006a01c0f4d875dca00a0a0a@rutgersinsurance.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

responses inline...

Adam Lang
Systems Engineer
Rutgers Casualty Insurance Company
http://www.rutgersinsurance.com
----- Original Message -----
From: "Chadwick Rolfs" <c2304182(at)webdevel(dot)urban(dot)csuohio(dot)edu>
To: "Adam Lang" <aalang(at)rutgersinsurance(dot)com>
Cc: <pgsql-php(at)postgresql(dot)org>
Sent: Wednesday, June 13, 2001 5:38 PM
Subject: Re: [PHP] Test

> Well, thank you very much. I hope that's not sarcasm I detect in this
> effort to educate the newbies. I should mention that I am a newbie, I am
> constantly reading the documentation, and that I KNOW WHERE TO START.
> Here. I got to this list from postgresql.org, and the php lists are tough
> to navigate (ie, i recieve, but can't seem to consistently post.)

It was not sarcasm. It was said exactly as it was emant. As someone else
posted, the list is not to tutor. Showing saying "this is what I want to
do, someone do it for me" is a waste of most of the listers time. The vast
majority of posts involving code are of the form "I have done this <post
code> and it still is not working, any ideas?". This shows you actually
tried doing work on your own first and have a basic understanding of what is
going on. Also, it helps us because we don't have to teach PHP, but instead
look to see where code went wrong or an idea went wrong.

This is actually pretty much the way it goes on the several programming
lists I am on. Nealry all of us have things to do besides these lists and
do not have the time to teach how to program from the beginning.

>
> Maybe, since you seem to be "in the know", you can point out one of the
> pgsql/php functions you have mentioned instead of giving me useless
> information. That would help...
> If you look closely, you'll see that there is a problem, there is really
> no function that takes web form contents (yes the name=value pairs, not
> the html tags (w3.org can do that!)) and puts these into :

I did point you in that direction. I said to go to www.php.net and search
on pg_connect and it should bring up all the relevant postgresql functions.
I just did it right now and on the left of teh screen ALL the postgresql
functions are listed.

As far as a function to get the data that was put into forms (input boxes,
select fields, etc.) , there is no function to do that. The variables are
passed to the next php script. You have to take the values and right your
own functions to stick them in the database... using the postgresql
functions available.

> insert into <table_name> ($web_form_names) values ($web_form_values);

That is the correct query. Except you don't pass the form name. You have
to get each variable by referencing each field it was put in.