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="me@me.com">
<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
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

Link to comment
Share on other sites

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=\"me@me.com\">
<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='me@me.com'>
<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

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.