wdesignergr Posted January 29, 2011 Share Posted January 29, 2011 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? Quote Link to comment Share on other sites More sharing options...
kickstart Posted January 29, 2011 Share Posted January 29, 2011 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 Quote Link to comment Share on other sites More sharing options...
wdesignergr Posted January 29, 2011 Author Share Posted January 29, 2011 i think that if i have single quotes the arrays shows as text. can u make me an example? thank u for everything Quote Link to comment Share on other sites More sharing options...
kickstart Posted January 29, 2011 Share Posted January 29, 2011 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 Quote Link to comment Share on other sites More sharing options...
wdesignergr Posted January 29, 2011 Author Share Posted January 29, 2011 thank u for everything keith...! i will try this Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.