Jump to content

form into print or echo


wdesignergr

Recommended Posts

Hello guys,

 

I want put one form into echo or print, but in the same time i want use $arrays on form.

 

Take a look here

 

<?php
print "<form action="https://www.moneybookers.com/app/payment.pl" method="post" target="_blank">
<input type="hidden" name="pay_to_email" value="[email protected]">
<input type="hidden" name="status_url" value="$mail"> 
<input type="hidden" name="language" value="GR">
<input type="hidden" name="amount" value="$price">
<input type="hidden" name="currency" value="EUR">
<input type="hidden" name="detail1_description" value="$pack">
<input type="hidden" name="detail1_text" value="$review">
<input type="submit" value="Pay!">
</form>";

?>

 

but all this make an error. from what i can understand, i cant put second "" ine print

Can u help me?

;)

 

 

Link to comment
https://forums.phpfreaks.com/topic/226041-form-into-print-or-echo/
Share on other sites

Hi

 

First problem is that you have double quotes within a string defined with double quotes. You need to delimit the quotes within the string (or use single quotes in the string).

 

To refer to an array variable within the string then either just break out of the string and concatenate them in (ie, Print "Some text ".$SomeArray['fred']." some more text";) or use the array variable within the string without quotes as php doesn't look for constants within string (ie Print "Some text $SomeArray[fred] some more text";).

 

All the best

 

Keith

Hi

 

If you have single OUTER quotes then anything within them is treated as text.

 

You can use either of the following

 

print "<form action=\"https://www.moneybookers.com/app/payment.pl\" method=\"post\" target=\"_blank\">
<input type=\"hidden\" name=\"pay_to_email\" value=\"[email protected]\">
<input type=\"hidden\" name=\"status_url\" value=\"$mail\"> 
<input type=\"hidden\" name=\"language\" value=\"GR\">
<input type=\"hidden\" name=\"amount\" value=\"$price\">
<input type=\"hidden\" name=\"currency\" value=\"EUR\">
<input type=\"hidden\" name=\"detail1_description\" value=\"$pack\">
<input type=\"hidden\" name=\"detail1_text\" value=\"$review\">
<input type=\"submit\" value=\"Pay!\">
</form>";
?>

 

or

 

print "<form action='https://www.moneybookers.com/app/payment.pl' method='post' target='_blank'>
<input type='hidden' name='pay_to_email' value='[email protected]'>
<input type='hidden' name='status_url' value='$mail'> 
<input type='hidden' name='language' value='GR'>
<input type='hidden' name='amount' value='$price'>
<input type='hidden' name='currency' value='EUR'>
<input type='hidden' name='detail1_description' value='$pack'>
<input type='hidden' name='detail1_text' value='$review'>
<input type='submit' value='Pay!'>
</form>";
?>

 

In either case you can do what I suggested with arrays

 

All the best

 

Keith

Archived

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

×
×
  • 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.