danjapro Posted November 7, 2011 Share Posted November 7, 2011 I have this form below, as selection to set a locaiton for user. However, when I click on the <li>, it post the form to the correct path, but does not take the value="name". what am I missing here, why is not taking the varibale "name". I'm I going down the right street. <form action='index.php' name="submitLocation" > <input type="hidden" name="option" value="commuinity" /> <input type="hidden" name='controller' value="deal" /> <input type="hidden" name='locationName' value="<?php echo $_POST["name"];?>" /> <input type="hidden" name="task" value="dealSetLocationCookie" /> <div id="city-option "> <img src="templates/deals/images/city_options.png" border="0" class="menu_class" /> <ul class="city_menu"> <li><a onclick="document.submitLocation.submit('atlanta');" title="atlanta" name="atlanta">atlanta</a></li> <li><a onclick="document.submitLocation.submit('chicago');" title="Chicago" name="Chicago">Chicago</a></li> <li><a onclick="document.submitLocation.submit('dallas');" title="Dallas" name="Dallas">Dallas</a></li> </ul> </div> </form> Quote Link to comment https://forums.phpfreaks.com/topic/250621-pass-variables-in-post-form-or-get-form/ Share on other sites More sharing options...
haku Posted November 7, 2011 Share Posted November 7, 2011 Javascript executes in the browser. At that point, all PHP is finished, and cannot execute, since it was all done on the server before the document was sent to the browser. You are trying to use PHP, but it's not going to work. As such, this is a javascript question. Moving. Quote Link to comment https://forums.phpfreaks.com/topic/250621-pass-variables-in-post-form-or-get-form/#findComment-1285864 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.