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="[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 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 Link to comment https://forums.phpfreaks.com/topic/226041-form-into-print-or-echo/#findComment-1166930 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 Link to comment https://forums.phpfreaks.com/topic/226041-form-into-print-or-echo/#findComment-1166932 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=\"[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 Link to comment https://forums.phpfreaks.com/topic/226041-form-into-print-or-echo/#findComment-1166942 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 Link to comment https://forums.phpfreaks.com/topic/226041-form-into-print-or-echo/#findComment-1166946 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.