/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Help with populating one field from another field selected

What am trying to do is when i select from Switch field I want Vendor to auto populate with $name. Below is the code that i am useing

[code=php] <label><strong>Switch:
<select name=”Switch” id=”Switch” >
<?php
while ($row_getSwitches = mysql_fetch_array($getSwitches))
{
$id = $row_getSwitches[‘Switch’];
$name = $row_getSwitches[‘Vendor’];
print “<option value=$id”;
if ($var == $id)
print ” selected”;
print “>$id–$namen”;
}

?>

</select>
</strong></label>
<strong>
<label>Person:
<select name=”Person” id=”Person”>
<?php
while ($row_getPerson = mysql_fetch_assoc($getPerson))
{
print “<option value='”.$row_getPerson[‘Person’].”‘>”.$row_getPerson[‘Person’].”</option>n”;
}
?>
</select>
</label>
</strong>
<label>Vendor
<input name=”Vendor” id=”Vendor” >
<?PHP

print “$namen”;
?>
</label>[/code]

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@gavshouseJan 26.2011 — You will need Javascript for that, check out the w3schools stuff on javascript and forms
Copy linkTweet thisAlerts:
@rwtrwt2003authorJan 26.2011 — i have read that but cant figure it out. Need Help

Thank you
Copy linkTweet thisAlerts:
@rwtrwt2003authorNov 07.2011 — This works thank you all for your help
Copy linkTweet thisAlerts:
@rwtrwt2003authorNov 07.2011 — Resolved
×

Success!

Help @rwtrwt2003 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 6.1,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...