nelquintin Posted June 13, 2010 Share Posted June 13, 2010 How can i display a array in a form? in the example below if i print "$path1"; it show the path. how do i insert this path in to the form? print '<form method="post" action="test2.php"> <input type="text" name="$path1"/><br/><br/> <input type="text" name="$path2"/><br/><br/> <input type="text" name="$path3"/><br/><br/> <input type="submit" name="submit"/> </form> '; print "$path1"; Quote Link to comment https://forums.phpfreaks.com/topic/204670-how-to-display-a-array-in-form/ Share on other sites More sharing options...
Alex Posted June 13, 2010 Share Posted June 13, 2010 Your example won't work because single-quotes don't have variable interpolation. If you use double quotes, and escape the other double quotes in your string, it will work. Quote Link to comment https://forums.phpfreaks.com/topic/204670-how-to-display-a-array-in-form/#findComment-1071558 Share on other sites More sharing options...
nelquintin Posted June 13, 2010 Author Share Posted June 13, 2010 sorry to be stupid if i put it in double quotes i get a parse error how do i escape? Quote Link to comment https://forums.phpfreaks.com/topic/204670-how-to-display-a-array-in-form/#findComment-1071566 Share on other sites More sharing options...
ohdang888 Posted June 13, 2010 Share Posted June 13, 2010 sorry to be stupid if i put it in double quotes i get a parse error how do i escape? by using the backslash "\" something like this: echo "<div id=\"test\"> yup</div> "; Quote Link to comment https://forums.phpfreaks.com/topic/204670-how-to-display-a-array-in-form/#findComment-1071591 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.