/    Sign up×
Community /Pin to ProfileBookmark

Problem in submit

Hi all

I dont know whether this is the right place to post this, plz

I am having a page with one dropdown
when the user changes the values a secong dropdown is loaded using ajax(am sending the full select box as a string and echoing in my page).

Upto this it works fine.But when i submit the form the POST array does not have the second dropdowns values (the dropdown itsself is missing in the POST array)

What could be wrong

plz advice

thanks in advance

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@MindzaiJul 10.2009 — We cannot help you unless you post your code. We are not mind readers!
Copy linkTweet thisAlerts:
@salimauthorJul 10.2009 — the dropdown which is loaded using ajax is not seen on the $_POST array.Rest of the form elements are present.
Copy linkTweet thisAlerts:
@ryanlundJul 10.2009 — Thats because the second dropdown box is never actually seen as part of the original form, so on submit its only posting the first one. You would need to use javascript to send the form from there if i remember rightly =s

As previously said, post your code up and we will help you from there.
Copy linkTweet thisAlerts:
@salimauthorJul 10.2009 — Thanks for your reply Ryan
[code=php]
public function getType($type, $currentVal='') {
$institutionTypes = array();
$str ='';
$calbakfunction = "'".site_url('admin/message/category')."'";

$instQuery = $this->ci->db->query("SELECT id,categoryName FROM category WHERE section= '".$type."' AND type = 'type'");
$instResultSet = $instQuery->result_array();

$str.='<select name="type" id="type" class="forms_text" onChange="showtype('.$calbakfunction.', this.value, 'cat')">';
$str.='<option value="">select </option>';
if(!empty($instResultSet)) {
foreach ($instResultSet as $type) {
$str.='<option value="'.$type["id"].'"';
if($type["id"]==$currentVal){
$str.=' selected="selected" >';
}
else {
$str.='>';
}
$str.=$type["categoryName"].'</option>';
}
}
$str.='</select>';
return $str;
}[/code]


This is how i make dropdown and will call this from a jquery ajax funtion

when the function returns the string i will update the innercontent of div

This is how i show dropdowns

upto this it is working as i can see the drop down and its values when i take the source code from my borwser.

But when i post the form ,$_POST does not contain the newly populated dropdowns

Where i went wrong??

can anybody shed some light

i am stuck

thanks in advance
×

Success!

Help @salim spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...