It is currently Sat Dec 15, 2018 11:31 pm


Post a new topicPost a reply Page 1 of 1   [ 15 posts ]
Author Message
 Post subject:
PostPosted: Thu Aug 21, 2008 6:58 am 
User avatar
Producers

Joined: Mon Aug 29, 2005 6:06 am
Posts: 790
Location: St Charles, Missouri, USA
Uru Live KI: 174162
Skype: Mowog1
Title: The Last Earbender
I recently inherited the webmaster position here in our school district, and while it's great fun, it also means that I've inherited whatever "features" were in the site, whether they worked or not.

The site has several forms that the staff or public can fill in and submit to enroll for classes, programs, etc. Those forms were all set up in FrontPage (which I despise), and are dependent on the FrontPage Server Extensions to function correctly. They're currently not working, and my attempts at a solution have run into several blind alleys.

So I decided to convert the forms to work via PHP, using Dreamweaver. I set up a test case, and the rework was surprisingly easy. Trouble is, even though the test form appears to submit correctly, no e-mails are kicked out.

I'm the only person in our department doing any kind of web development work, and our server guru is unfamiliar with PHP. Go figure... So it occurred to me to post this question here, and let you guys play with it.

If it will help, here's a link to my test form:

<a href="http://www.stcharles.k12.mo.us/departments/parents_teach/enroll_form_test.htm" target="_blank">http://www.stcharles.k12.mo.us/departments...l_form_test.htm</a>

And here's the content of the PHP file that handles the e-mail:

<! :#FFFF00--> "color:#FFFF00"><!--/ ><blockquote><?php
//--------------------------Set these parameters--------------------------

// Subject of email sent to you.
$subject = 'PAT Enrollment';

// Your email address. This is where the form information will be sent.
$emailadd = 'gketcherside@mail.stcharles.k12.mo.us';

// Where to redirect after form is processed.
$url = 'http://www.stcharles.k12.mo.us/departments/parents_teach/parents_teach.asp';

// 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.
$req = '0';

// --------------------------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 >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($MothersName, $FathersName, $Address, $City, $State, $Zip, $Subdivision, $HomeSchool, $HomePhone, $MotherPhone, $FatherPhone, $Email, $Child1Name, $Child1DateOfBirth, $Child1Premature, $Child2Name, $Child2DateOfBirth, $Child2Premature, $Child3Name, $Child3DateOfBirth, $Child3Premature, $HearAboutPAT, $Morning, $Afternoon, $Evening, $EveningTime, $Saturday, $Notes, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?></blockquote><!--colorc--> <!--/colorc-->

Thanks a million! I thought I had this one licked, but apparently not... I suspect I missed something simple. Or... does the server need to be set up to handle PHP?

Mowog

_________________
Image


Last edited by Mowog on Thu Aug 21, 2008 7:00 am, edited 1 time in total.

Top
 Offline Profile  
 
 Post subject:
PostPosted: Thu Aug 21, 2008 3:24 pm 
Production Staff

Joined: Sat Aug 27, 2005 10:15 am
Posts: 664
Location: Cape Town, South Africa
Hi Mowog

Good job so far. You'll kick yourself when you see what you did wrong.

The line where you call the mail() function... You're giving it far too many parameters. It should be in the form:

bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )

So perhaps you want something like

Code:
$result = mail  ( $emailadd  , $subject  , $var1 . "\n" . $var2 . "\n" . $var3 );
echo $result;


Where $var1, etc are $MothersName, $FathersName, $Address, ... etc

Hope that helps :)

You can read more at <a href="http://www.php.net/manual/en/function.mail.php" target="_blank">http://www.php.net/manual/en/function.mail.php</a>

-Miles

_________________
Miles | Co-Founder | Graphic Designer | Mac Addict | :)


Last edited by Miles on Thu Aug 21, 2008 3:26 pm, edited 1 time in total.

Top
 Offline Profile  
 
 Post subject:
PostPosted: Fri Aug 22, 2008 10:30 am 
User avatar
Producers

Joined: Mon Aug 29, 2005 6:06 am
Posts: 790
Location: St Charles, Missouri, USA
Uru Live KI: 174162
Skype: Mowog1
Title: The Last Earbender
Hey, thanks for the reply. Okay, here is the edited version of my "mail call:"

Code:
$result = mail($emailadd, $subject, $MothersName, "\n". $FathersName, "\n". $Address, "\n". $City, "\n". $State, "\n". $Zip, "\n". $Subdivision, "\n". $HomeSchool, "\n". $HomePhone, "\n". $MotherPhone, "\n". $FatherPhone, "\n". $Email, "\n". $Child1Name, "\n". $Child1DateOfBirth, "\n". $Child1Premature, "\n". $Child2Name, "\n". $Child2DateOfBirth, "\n". $Child2Premature, "\n". $Child3Name, "\n". $Child3DateOfBirth, "\n". $Child3Premature, "\n". $HearAboutPAT, "\n". $Morning, "\n". $Afternoon, "\n". $Evening, "\n". $EveningTime, "\n". $Saturday, "\n". $Notes)


Is that what you meant? I understand that the "\n" represents a line break. Actually, I don't see that much difference from what I had originally. I did change the "mail()" to "result = mail()." Was that correct?

I ask because I tested this edited script and still didn't receive a mailing as a result. If this is any help, our web server is running Windows 2000 Server. And I understood from previous reading that the PHP mail script would work independently of any mail clients that may or may not be installed on the server - correct? Just making sure.

Thanks!

Mowog

_________________
Image


Last edited by Mowog on Fri Aug 22, 2008 10:39 am, edited 1 time in total.

Top
 Offline Profile  
 
 Post subject:
PostPosted: Fri Aug 22, 2008 12:20 pm 
Production Staff

Joined: Fri Nov 11, 2005 6:48 am
Posts: 730
Location: Belgium
Uru Live KI: 0
Mainly: I would suggest to look at Joomla or Drupal, those site creators/CMSs (content managment systems) are very popular and make things easier while not taking away power and they also output valid code (so it has the power of dreamweaver but some what of the easiness of frontpage).

Right now I'm to tired to look through your code, the download counter has eaten up all my inspiration of today.

_________________
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GM d- s+:- a--- C++>$ UL++ P L++>++++ E---- W+++$ N+ o? K- w>--- O-- M+ V? PS++ PE-- Y PGP++ t+(-) 5+ X R tv b+ DI D G+ e->++++ h! r-- y+
------END GEEK CODE BLOCK------


Top
 Offline Profile  
 
 Post subject:
PostPosted: Fri Aug 22, 2008 1:22 pm 
User avatar
Producers

Joined: Mon Aug 29, 2005 6:06 am
Posts: 790
Location: St Charles, Missouri, USA
Uru Live KI: 174162
Skype: Mowog1
Title: The Last Earbender
<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->Mainly: I would suggest to look at Joomla or Drupal, those site creators/CMSs (content managment systems) are very popular and make things easier while not taking away power and they also output valid code (so it has the power of dreamweaver but some what of the easiness of frontpage).<!--QuoteEnd--></div><!--QuoteEEnd-->

I'm using Dreamweaver actually, and have a working familiarity with it. The only real problem here is that off-the-shelf PHP scripts don't seem to work on our Win2000 Server. Sigh...

Thanks,

Mowog

_________________
Image


Top
 Offline Profile  
 
 Post subject:
PostPosted: Fri Aug 22, 2008 3:30 pm 
Production Staff

Joined: Sat Aug 27, 2005 10:15 am
Posts: 664
Location: Cape Town, South Africa
Almost...

Comma's seperate parameters. Full-stops concat variables. The code below should work :)

Code:
$result = mail($emailadd, $subject, $MothersName . "\n". $FathersName . "\n". $Address . "\n". $City . "\n". $State . "\n". $Zip . "\n". $Subdivision . "\n" . $HomeSchool . "\n" . $HomePhone . "\n" . $MotherPhone . "\n" . $FatherPhone . "\n" . $Email . "\n" . $Child1Name . "\n" . $Child1DateOfBirth . "\n" . $Child1Premature . "\n" . $Child2Name . "\n" . $Child2DateOfBirth . "\n" . $Child2Premature . "\n" . $Child3Name . "\n" . $Child3DateOfBirth . "\n" . $Child3Premature . "\n" . $HearAboutPAT . "\n" . $Morning . "\n" . $Afternoon . "\n" . $Evening . "\n" . $EveningTime . "\n" . $Saturday . "\n" . $Notes)


M

_________________
Miles | Co-Founder | Graphic Designer | Mac Addict | :)


Last edited by Miles on Fri Aug 22, 2008 3:33 pm, edited 1 time in total.

Top
 Offline Profile  
 
 Post subject:
PostPosted: Mon Aug 25, 2008 8:21 am 
User avatar
Producers

Joined: Mon Aug 29, 2005 6:06 am
Posts: 790
Location: St Charles, Missouri, USA
Uru Live KI: 174162
Skype: Mowog1
Title: The Last Earbender
Did some more digging this morning. If this will help, our web server is running IIS and FrontPage Extensions. When I tried to install WAMPP, I got the following error:

Image

I chatted with our resident server guy, and he said that IIS and Apache are two different web servers (which I guess I already knew), and that (obviously) you can't run both at once.

/me scratches head.

Gaaahhh. Again, and by way of a recap, what started this is that our online forms were throwing errors on submit. We apparently need to recalculate web links (according to the Microsoft support knowledgebase) to make the FrontPage extensions work again; but any attempt to recalc the links brings up a different error... that the admin software is out of date. And even though I found a workaround for that one, the fix - editing a CNF file to change the Server Extensions version number - is impossible, because the CNF file in question has apparently been associated with NetMeeting as a SpeedDial config file. (Quick note - could this be the cause of the problem in the first place?)

You see what we're going through with this one... seems like every solution is turning into a blind alley. Argh.

Mowog

_________________
Image


Last edited by Mowog on Mon Aug 25, 2008 9:49 am, edited 1 time in total.

Top
 Offline Profile  
 
 Post subject:
PostPosted: Mon Aug 25, 2008 9:43 am 
User avatar
TCT Member

Joined: Wed May 10, 2006 7:48 pm
Posts: 467
Location: Oklahoma
Hmm you might want to see if you are running IIS instead. If so its unlikely you have php working and may have to get it added.

_________________
Image


Last edited by Anthony on Mon Aug 25, 2008 9:43 am, edited 1 time in total.

Top
 Offline Profile  
 
 Post subject:
PostPosted: Mon Aug 25, 2008 9:49 am 
User avatar
Producers

Joined: Mon Aug 29, 2005 6:06 am
Posts: 790
Location: St Charles, Missouri, USA
Uru Live KI: 174162
Skype: Mowog1
Title: The Last Earbender
Oops, we cross posted. See my note above. Can you clarify how to add PHP to IIS?

Thanks!

Mowog

_________________
Image


Last edited by Mowog on Mon Aug 25, 2008 9:51 am, edited 1 time in total.

Top
 Offline Profile  
 
 Post subject:
PostPosted: Mon Aug 25, 2008 9:50 am 
User avatar
TCT Member

Joined: Wed May 10, 2006 7:48 pm
Posts: 467
Location: Oklahoma
Get them to install fastCGI on IIS and then php or even better if you can just php (I don't know if there is a mod_php like thing for iis) and then the php should work if you get it set up.

_________________
Image


Top
 Offline Profile  
 
 Post subject:
PostPosted: Mon Aug 25, 2008 10:18 am 
User avatar
TCT Member

Joined: Wed May 10, 2006 7:48 pm
Posts: 467
Location: Oklahoma
<a href="http://us3.php.net/manual/en/install.windows.iis.php" target="_blank">http://us3.php.net/manual/en/install.windows.iis.php</a>

_________________
Image


Top
 Offline Profile  
 
 Post subject:
PostPosted: Mon Aug 25, 2008 10:21 am 
User avatar
Producers

Joined: Mon Aug 29, 2005 6:06 am
Posts: 790
Location: St Charles, Missouri, USA
Uru Live KI: 174162
Skype: Mowog1
Title: The Last Earbender
Thanks, Ant. Part of the problem is that the guy who would usually take care of any server setups like the one you suggested is swamped at the moment with other matters (being the start of the school year), so it's fallen to me. Which is fine, but I'm a novice when it comes to this sort of thing. And even though I'm thrilled to do it, I'm learning as I go and need some pretty specific walkthroughs. (Edit - Just noticed your post above, thanks.)

And as I noted above, I'm starting to suspect that the service.cnf file that normally stores data relevant to the FrontPage Server Extensions has somehow reassociated itself with NetMeeting, as it is now identified as a SpeedDial file. Funny, because NetMeeting isn't even installed on the server, AFAIK. One of the MS support articles mentioned this happening. So perhaps the FrontPage extensions are looking to that file for pertinent info, finding nothing, and throwing an error.

Anyway, let me do some digging on that. Thanks again for all the help, you guys. I just want to get this one fixed and move on!

Later,

Mowog

_________________
Image


Last edited by Mowog on Mon Aug 25, 2008 10:22 am, edited 1 time in total.

Top
 Offline Profile  
 
 Post subject:
PostPosted: Mon Aug 25, 2008 12:23 pm 
User avatar
Producers

Joined: Mon Aug 29, 2005 6:06 am
Posts: 790
Location: St Charles, Missouri, USA
Uru Live KI: 174162
Skype: Mowog1
Title: The Last Earbender
Disregard most of the above -

Here's the initial problem: <a href="http://support.microsoft.com/kb/301071/en-us" target="_blank">http://support.microsoft.com/kb/301071/en-us</a>

As mentioned in the last post, I tried reassociating service.cnf to Notepad vs. NetMeeting, and lo and behold it worked, and I was able to edit it; and that allowed me to recalculate the site links as suggested in that article. Bully.

BUT -

The forms are still generating errors. Looks like I may just need to reinstall the FrontPage Server Extensions.

$#^&%^ Microsoft...

Mowog

_________________
Image


Top
 Offline Profile  
 
 Post subject:
PostPosted: Tue Aug 26, 2008 1:09 pm 
Production Staff

Joined: Fri Nov 11, 2005 6:48 am
Posts: 730
Location: Belgium
Uru Live KI: 0
You could also do this (I know it's very drastic but it's the way I prefer):

you can also upload frontpage website's using FTP, so you could throw ******* IIS away and install a Apache and PHP (please do NOT use WAMP in other things than internal networks, WAMP is not configured to be a public webserver).
So you would install Apache and PHP after uninstalling IIS and perhaps add mod_php and then just upload your frontpage site manually (the apache FPSE are no longer available and make apache look like cheese, lots of holes).

You could also keep in tinkering the M$ stuff but I'm afraid I can't help you with that, I do not have any idea how their server software works (I guess this is how it is supposed to work, so you take an expensive support contract)

_________________
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GM d- s+:- a--- C++>$ UL++ P L++>++++ E---- W+++$ N+ o? K- w>--- O-- M+ V? PS++ PE-- Y PGP++ t+(-) 5+ X R tv b+ DI D G+ e->++++ h! r-- y+
------END GEEK CODE BLOCK------


Top
 Offline Profile  
 
 Post subject:
PostPosted: Tue Aug 26, 2008 1:38 pm 
User avatar
Producers

Joined: Mon Aug 29, 2005 6:06 am
Posts: 790
Location: St Charles, Missouri, USA
Uru Live KI: 174162
Skype: Mowog1
Title: The Last Earbender
Thanks again -

I was able to stamp out pretty much all the bugs, and while the forms still don't submit correctly, at least I've managed to change the error message. That's always a sign of progress.

I've pretty much decided to start editing the site in FrontPage - or at least editing and publishing the forms pages in FrontPage. I get the impression that FrontPage kind of marches to its own drummer, and if you edit a FrontPage site in some other web app, things break.

Sigh. I know I said this before, but I don't like FrontPage.

Anyway, I'm closing this ticket for now. :lol: At least I learned something about PHP that I can use later.

Cheers,

Mowog

_________________
Image


Last edited by Mowog on Tue Aug 26, 2008 1:39 pm, edited 1 time in total.

Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 15 posts ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

This work is licensed under a Creative Commons By-NC-ND 3.0 License. Powered by phpBB