Reply
Moving from E-mail submission to Database storage?
Old 06-08-2005, 02:01 PM Moving from E-mail submission to Database storage?
Average Talker

Posts: 21
Here is my php that goes through and sends an email to the registrant and to myself.

Code:
<?php

// Simple Form Script
// Copyright (C) 2005  Eric Zhang
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// Please send bugs/questions to erkzh@yahoo.com.

//--------------------------Set these paramaters--------------------------


$subject = 'WMAW 2005 Form Submission';      // Subject of email sent to you.
$subject2 = 'WMAW 2005 Form - Registrant';   // Subject of email sent to registrant.
$emailadd = 'sydcomebak@aol.com';            // Your email address. This is where the form information will be sent.
$url = 'http://www.wmaw2005.com';            // Where to redirect after form is processed.
$req = '0';                                  // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";       
$space = '  ';
$line = '
';
foreach ($_POST as $key => $value)
{
	if ($req == '1')
	{
		if ($value == '')
		{echo "$key is empty";die;}
	}
	$j = strlen($key);
		if ($j >= 35)
		{echo "Name of form element $key cannot be longer than 35 characters";die;}
	$j = 35 - $j;
		for ($i = 1; $i <= $j; $i++)
		{$space .= ' ';}
	$value = str_replace('\n', "$line", $value);
	$conc = "{$key}:$space{$value}$line";
	$text .= $conc;
	$space = '  ';
}
mail($emailadd, $subject,  $text, 'From: '.$emailadd.'');
mail($email,    $subject2, $text, 'From: Registrar@WMAW2005.com');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>
Rather than collecting all of these emails(200+) and entering the information into the DB by hand, I figure that it'd be much better to turn around and have the php do the work for me. Any suggestions on where to start?

Thanks!

-Dave in IL
sydcomebak is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 06-08-2005, 04:00 PM
Uche's Avatar
Extreme Talker

Posts: 174
Location: Nigeria/Lagos
Do you want it to submit to DB ??
__________________
Life is just lyke a school where everybody goes to learn one or two thing. the more u school, the more u learn more about school..The more we live our lifes.. the more we learn more about life.
http://www.smartsoft-ng.com
Uche is offline
Reply With Quote
View Public Profile Visit Uche's homepage!
 
Old 06-08-2005, 04:07 PM
Average Talker

Posts: 21
pretty much!

Here's the reg page:

www.wmaw2005.com/2005/registration/reg.php

the txt version:

www.wmaw2005.com/2005/registration/reg.txt

So I'll have to have the DB table keep a running count of registrants, (reg_id) or something, store their last_name, first_name, email, and other various choices that they make in the form.

Thanks for the prompt response! My DB guy quit and we're supposed to open registration on the 15th!

-Dave in IL
sydcomebak is offline
Reply With Quote
View Public Profile
 
Old 06-08-2005, 04:17 PM
Uche's Avatar
Extreme Talker

Posts: 174
Location: Nigeria/Lagos
i saw the Reg page.. can you gv me the structure of the dB hey PM Private here is my yahoo id php_guy_uche@yahoo.com
__________________
Life is just lyke a school where everybody goes to learn one or two thing. the more u school, the more u learn more about school..The more we live our lifes.. the more we learn more about life.
http://www.smartsoft-ng.com
Uche is offline
Reply With Quote
View Public Profile Visit Uche's homepage!
 
Reply     « Reply to Moving from E-mail submission to Database storage?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12288 seconds with 12 queries