/    Sign up×
Community /Pin to ProfileBookmark

pass multiple values from iframe to parent

Right now I can only pass Make_name..how can I pass Model too?

Parent:

[CODE]<script language=”javascript”>
function post(string){
var name=string
document.getElementById(‘make_name’).value=name;

}
</script>

<iframe src=”makemodel_dropdowns.php” height=”100px” width=”300px” frameborder=”0″>Cannot See iframe</iframe><br />

<input type=”text” id=”make_name” value=”<?php echo $make_name; ?>” name=”make”/><br />
<input type=”text” value=”<?php echo $model; ?>” name=”model”/>[/CODE]

Iframe:

[code=php]<select name=”model” onchange=”parent.post(this.form…????);” >
<option value=”default2″>Choose Model:</option>
<?php

///////// Getting the data from Mysql table for Make list//////////
$result=mysql_query(“SELECT model_name FROM models WHERE make_id =’$make_id’ ORDER BY model_name”);
///////////// End of query for Make list////////////

while($query_data = mysql_fetch_row($result)) {
?>
<option value=”<?php echo $query_data[0]; ?>”><?php echo $query_data[0]; ?></option>
<?php
}
?>
</select>

<input name=”make_name” type=”hidden” value=”<?php echo $make_name; ?>”[/code]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@buildingbrickauthorApr 12.2010 — PARENT:

[CODE]<script language="javascript">
function post(array){
var make=array['0']
var model=array['1']
document.getElementById('make_name').value=make;
document.getElementById('model').value=model;


}
</script>[/CODE]


IFRAME:

[code=php]<select name="model" onchange="parent.post(FAKE create array FAKE);" >
<option value="default2">Choose Model:</option>
<?php

///////// Getting the data from Mysql table for Make list//////////
$result=mysql_query("SELECT model_name FROM models WHERE make_id ='$make_id' ORDER BY model_name");
///////////// End of query for Make list////////////

while($query_data = mysql_fetch_row($result)) {
?>
<option value="<?php echo $query_data[0]; ?>"><?php echo $query_data[0]; ?></option>
<?php
}
?>
</select>[/code]
×

Success!

Help @buildingbrick 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,
)...