alan93 Posted May 9, 2006 Share Posted May 9, 2006 I have been trying to figure out how to get a formmail.pl to work with PHP validation codeI have:[code]<?php/* validation.php */require_once ('validation.php');$valid = TRUE;if (isset ($_POST['B1'])) {.....validation code here with functions from validation.php $valid = }?>HTML ..............<?phpif (!$valid) {?><style type="text/css">td.error {color: red; font-weight:bold; }</style>Please correct the items in red and resubmit.<br /><br /><?php}?><form method="POST" action="http://www.mywebsite.com/cgi-bin/FormMail.pl"><input type="submit" value="Submit Form" name="B1">&................</HTML>[/code]when submit is clicked, it calles the formmail.pl but does nothing in the phpSo do I make action= self??then how do I call the formmail.pl? Quote Link to comment Share on other sites More sharing options...
ober Posted May 9, 2006 Share Posted May 9, 2006 If you make the action "self", it's going to run the PHP and not the Perl. You need to figure out how to call one from the other or do a redirect to your processing PHP page after the Perl script exits.I'd tell you how to do that, but I don't have the slightest clue. Quote Link to comment Share on other sites More sharing options...
alan93 Posted May 9, 2006 Author Share Posted May 9, 2006 [!--quoteo(post=372696:date=May 9 2006, 02:49 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ May 9 2006, 02:49 PM) [snapback]372696[/snapback][/div][div class=\'quotemain\'][!--quotec--]If you make the action "self", it's going to run the PHP and not the Perl. You need to figure out how to call one from the other or do a redirect to your processing PHP page after the Perl script exits.I'd tell you how to do that, but I don't have the slightest clue.[/quote]Well the PERL script sends an e-mail so the PHP validation needs to happen first.If there is a solution using these two it doesn't seem to be an easy one. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted May 9, 2006 Share Posted May 9, 2006 If you want to run the PHP code first then you'll want to change the action so the form submits to itself, checks whether everthing is valid and the use the header function redirect to the perl script, however you need to pass the POSTed data to perl script in the URL then in per get the GET information from the url.Thats the only way. Or just use PHP to send the email Quote Link to comment Share on other sites More sharing options...
alan93 Posted May 9, 2006 Author Share Posted May 9, 2006 [!--quoteo(post=372711:date=May 9 2006, 03:15 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ May 9 2006, 03:15 PM) [snapback]372711[/snapback][/div][div class=\'quotemain\'][!--quotec--]If you want to run the PHP code first then you'll want to change the action so the form submits to itself, checks whether everthing is valid and the use the header function redirect to the perl script, however you need to pass the POSTed data to perl script in the URL then in per get the GET information from the url.Thats the only way. Or just use PHP to send the email[/quote]thanks.....wow......looks like i need to dump the perl script or the php validation and then add the missing part.The perl script redirects also too.Guess i should just do everything in PHP.I've seen some people put the whole HTML code inside the header function.Is that possible? then it runs the action= when submit has a value? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.