gjwolf1 Posted February 26, 2011 Share Posted February 26, 2011 I have an hml page that uses option values and lets the user select values. the values are php pages which when they submit pass the chosen value to the next page I show a snip below. I wanted to have the form action grab the formVar passed to it- but I can't seem to get it going. I figure I just may not be putting the post in correctly- any help appreciated <head><title>page2</title></head> <body> <form action=="<?php $_POST['formVar']; ?>" method="POST"> Quote Link to comment https://forums.phpfreaks.com/topic/228912-passing-post-in-html/ Share on other sites More sharing options...
harristweed Posted February 26, 2011 Share Posted February 26, 2011 <form action="<?php echo($_POST['formVar']}; ?>" method="POST"> Quote Link to comment https://forums.phpfreaks.com/topic/228912-passing-post-in-html/#findComment-1179979 Share on other sites More sharing options...
gjwolf1 Posted February 26, 2011 Author Share Posted February 26, 2011 thank you for replying, I tried still it doesn't work- is it missing a } ? I tried this way <form action="<?php echo{$_POST['formVar']}; ?>" method="POST"> and this way w/ no luck <form action="<?php echo($_POST['formVar']); ?>" method="POST"> any help appreciated Quote Link to comment https://forums.phpfreaks.com/topic/228912-passing-post-in-html/#findComment-1180013 Share on other sites More sharing options...
harristweed Posted February 27, 2011 Share Posted February 27, 2011 this should work <form action="<?php echo $_POST['formVar']; ?>" method="POST"> If it does not, check that $_POST['formVar'] is set and contains a value Quote Link to comment https://forums.phpfreaks.com/topic/228912-passing-post-in-html/#findComment-1180237 Share on other sites More sharing options...
gjwolf1 Posted February 27, 2011 Author Share Posted February 27, 2011 Hi Harris- you were right as I did screw up the variable input, it is correct now but the code below still only comes up literal and will not let the post value be set in there <html> <head><title>Config input form</title></head> <body> <form action="<?php echo $_POST['item']; ?>" method="POST"> <b>Location name ie. Beaumont</b><br> this has the same result willl still not let the variable from post be set within those quotes, it will come up literal as it is in the browser string have you seen an example or something maybe that I can see work, I cannot get it working Quote Link to comment https://forums.phpfreaks.com/topic/228912-passing-post-in-html/#findComment-1180328 Share on other sites More sharing options...
harristweed Posted February 27, 2011 Share Posted February 27, 2011 Has the page got a .php extension? Quote Link to comment https://forums.phpfreaks.com/topic/228912-passing-post-in-html/#findComment-1180445 Share on other sites More sharing options...
gjwolf1 Posted February 28, 2011 Author Share Posted February 28, 2011 wow that was it Harris- thank you so much for helping me I'm just confused as to why it was needed as the html had the <?php part within that form action and I thought that called php and would be ok Quote Link to comment https://forums.phpfreaks.com/topic/228912-passing-post-in-html/#findComment-1180618 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.