Jump to content

Archived

This topic is now archived and is closed to further replies.

alan93

submit, action , $_POST[] problem

Recommended Posts

I have been trying to figure out how to get a formmail.pl to work with PHP validation code

I 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 ..............

<?php
if (!$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 php

So do I make action= self??
then how do I call the formmail.pl?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[!--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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
[!--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?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.