Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing PHP array to Perl 1

Status
Not open for further replies.

stmosaic

IS-IT--Management
Nov 10, 2004
10
US
I'm very weak in Perl/PHP, spent the last 2 days figuring out passing multiple checkboxes to a PHP page and was able to figure it out with some help from online tutorials. But now I'm stuck, I've searched for any working solutions similar to my dilemma: how to pass the dynamic PHP array to Perl for emailing. The code doesn't throw any errors, but it doesn't send the info either. Here is the code from the PHP page:
<code>
<?php

foreach($_POST['ptitle'] as $key => $ptitle) {
print("<br><input type=\"checkbox\" name=\"ptitle[]\" value=\"$ptitle\" checked>" . $ptitle);
}

?>
</code>
This is the code from within a subroutine on my .pl page:
<code>
print MAIL "PROPERTIES OF INTEREST: ";
foreach $ptitle (@ptitle)
{
print "$value ", "\n";
}
</code>
I've looked for any similar solutions and read perl books, but all it's maganged to do is confuse me even more! I would appreciate any help you Perl and PHP experts can give me on this!
 
The trick of using 'name="foo[]"' on web forms is PHP-specific. perl, as I understand it, won't recognize foo as an array.

But if you're outputting a form in PHP that will submit to a perl script, have the PHP script output a form which is perl-compatible. What constitutes a perl-compatible form is a question for the perl form.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
What's the need to mix two languages?
Can't you achieve what you are looking for in either? For example, mailing from PHP is a breeze, so I'm wondering why you would go and use an outside script...
 
The perl part already exists and is used for routing and other purposes. I was trying to help my employer and become familiar with PHP. I've had to pass this project on to our perl consultant to finish, it was taking me waaay to long to figure out. For my next attempt, I'm just going to start from scratch with PHP, it makes more sense to me. Thank you everyone for the great help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top