Forum Moderators: open

Message Too Old, No Replies

Form to SQL? HELP?!

         

webhunter

9:16 pm on Feb 8, 2006 (gmt 0)

10+ Year Member



I am developing an opt in email list of people who study martial arts in order to send out a weekly newsletter.
I will be using Subscribeme Pro newsletter management software that sits in the cgi-bin
A subscriber will his email address into a form on my homepage and the form action sends the email address to the newsletter management software which then handles the opt-inconfirmation process.

I also want to capture the type of martial art each subscriber studies (tae kwon do, kung fu, etc)
I have a drop down list within the form allowing the user to select their martial art.
I have created an sql database with 3 fields (date, email address and martial art)

How do I post the email address data to the newsletter management software and also populate the mysql database? Can this be done from the single form?

Here is the form code provided by the newsletter management software:

<!--START COPY HERE--> <FORM ACTION="/~defense/cgi-bin/subscribeme/s.pl" METHOD="POST"> <TABLE BORDER="0"> <TBODY> <TR> <TD BGCOLOR="#FFFFFF"> <CENTER><FONT SIZE="-2" FACE="verdana, arial, helvetica"><B>Join our mailing list<BR> for new and<BR> updated information!</B></FONT><BR> <INPUT TYPE="TEXT" SIZE="10" NAME="e"></CENTER> <INPUT TYPE="RADIO" NAME="subscribe" VALUE="subscribe" CHECKED="CHECKED" ALIGN="TOP"> <INPUT TYPE="HIDDEN" NAME="l" VALUE="1"> <FONT SIZE="-2" FACE="verdana, arial, helvetica">subscribe</FONT><BR> <INPUT TYPE="RADIO" NAME="subscribe" VALUE="unsubscribe" ALIGN="TOP"> <FONT SIZE="-2" FACE="verdana, arial, helvetica">unsubscribe</FONT><BR> <CENTER><INPUT TYPE="SUBMIT" VALUE=" Submit "></CENTER></TD> </TR></TBODY> </TABLE></FORM> <!--END COPY HERE-->

physics

9:23 pm on Feb 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



When that form is submitted to the newsletter management script the script grabs the form variables and puts them into the newsletter's database. If you want to also put the information into another database things get a bit more complicated as you'll have to either hack the existing scrpt to do this also or something like that.
You might do better to have a two page form, the first one submits info to the newsletter script and the second one submits data to your sql database through a perl or php program (that you will need to write).

physics

9:24 pm on Feb 8, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



By the way, welcome to Webmaster World!

webhunter

3:56 am on Feb 9, 2006 (gmt 0)

10+ Year Member



Physics,
Thanks for your reply.
Can the form action line invoke more than one file?
Can I have it pass the variable to the newsletter management software AND pass it to mysql via php in the same command line?

Can this be done with javascript?

I really don't want to require the subscribers to fill out more than one form.
I have a beta page up; see what I mean:

<snip>
Thanks!

[edited by: engine at 3:26 pm (utc) on Feb. 9, 2006]
[edit reason] no urls, thanks [/edit]

volatilegx

9:19 pm on Feb 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> Can the form action line invoke more than one file?

I don't think so.

However, you could hack your newsletter processing script to call a second script which would add the info to your database, or simply include the database query in the first script. Either way, you'll need to do some scripting (or hire it out) to accomplish your objective.

webhunter

2:04 am on Feb 10, 2006 (gmt 0)

10+ Year Member



Thanks again.

Just another thought.

Could I pass the variables from the form on my homepage to a cgi script on the server that would then do 2 things?
1. populate the database
2. pass the variables to the newsletter program via a post command as if they were coming from the form on the webpage?

If so, do you know someone who could write this?

Thanks,

Neil

jatar_k

1:35 am on Feb 11, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could do the insert and then post to the mgmt script but you would need to use cURL or sockets and that gets a little messy/complicated sometimes

my wild guess is that the newsletter mgmt software uses a db, you could just insert directly into it's db but you would have to take time to figure out how to do it right.