danjapro — 2011-11-07T08:57:44-05:00 — #1
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" />
<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>
starlion — 2011-11-07T09:17:19-05:00 — #2
you have not defined a "method" attribute for your form tag.
guido2004 — 2011-11-07T09:18:27-05:00 — #3
You mean the hidden form field locationName? The value for that form variable comes from $_POST['name']. Are you sure that it exists and has a value? Take a look at the html code in your browser. What value does that field have?
immerse — 2011-11-07T10:31:25-05:00 — #4
The location you have stored in the title tags of your <a> tags. Those aren't submitted when you submit the form.
Also, passing the name of the location as a parameter to the submit() function on the form doesn't do anything either.
Any reason why you're not using a <select> for the location?
danjapro — 2011-11-07T15:47:46-05:00 — #5
I am using <ul><li> instead of select, for jquery styling I added for cool dropdown.
Just need to send the value with click on the <a href> for each list item.
Help if you can.
danjapro — 2011-11-07T15:52:30-05:00 — #6
I am trying to pass it as in this form is setup, But I al using jquery <ul><li> styling that allows me to make dropdown look and work with jQuery. Do not want to look the effect.
Just want the onClick event to pass the variable = name(ex.atlanta, dallas) to the form and that's it.
I can get the form to submit currently when I click on each List item, but it does not carry of load the vairable name with form as it post.
<input type="hidden" name='locationName' value="<?php echo $_POST["name"];?>" /> Ho do I get the variable to be passed along when form is submitted with correct variable or (city) loading in post as "name"?
cups — 2011-11-07T16:43:38-05:00 — #7
This sounds like a jQuery question to me.
If you have a form element such as this : (note it needs an id and a name for JS interaction IIRC)
<input type="hidden" name='locationName' id='locationName' value="" />
Then you can tell jQuery to capture the ul/li/a onclick event, assign it to the form element whose id is 'locationName' then submit the form.
danjapro — 2011-11-08T00:56:37-05:00 — #8
Thank you all for your direction ans support, I have been a member here for some years, I must say. Guys, don't always give you direct assistance.
But when you get help on these forums. I tell you You get the bessssstessssstsssssssssssssssssssss guidance anyone can ask for.
Liek getting advice from small-geek god childs.
Respect to everyone who supports this forum, big up lon gtime. Rah Rah Rah