Jump to content


Photo

submit, action , $_POST[] problem


  • Please log in to reply
4 replies to this topic

#1 alan93

alan93
  • Members
  • Pip
  • Newbie
  • 5 posts

Posted 09 May 2006 - 06:30 PM

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

I have:


<?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>


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?



#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 09 May 2006 - 06:49 PM

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.

Info: PHP Manual


#3 alan93

alan93
  • Members
  • Pip
  • Newbie
  • 5 posts

Posted 09 May 2006 - 07:02 PM

[!--quoteo(post=372696:date=May 9 2006, 02:49 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ May 9 2006, 02:49 PM) View Post[/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.

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 09 May 2006 - 07:15 PM

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

#5 alan93

alan93
  • Members
  • Pip
  • Newbie
  • 5 posts

Posted 09 May 2006 - 07:26 PM

[!--quoteo(post=372711:date=May 9 2006, 03:15 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ May 9 2006, 03:15 PM) View Post[/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?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users