Jump to content

submit, action , $_POST[] problem


alan93

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?

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.