Jump to content

Recommended Posts

 

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>

Link to comment
https://forums.phpfreaks.com/topic/250621-pass-variables-in-post-form-or-get-form/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.