hi all,
Im doing in-house project ... Im creating form which has a drop down box for gender.... and also a document which contains "he/she" type... when i select the male option in that dropdown box the doc which contains "he/she" should autopopulate to its corresponding gender and generate it into a document.... please help me...

The most simplest approach to do this would be to submit a form and have php do the replace for you using http://us3.php.net/preg_replace

using jquery/ajax would make it nice with no form submission, but that might be a bit above your level.

You don't need PHP to do this! All you need is some JavaScript:

<html>
<head>
<title>Gender  Drop Down Test</title>
<script type="text/javascript">
function selectGender(value, id){document.getElementById(id).value=value;}
</script>
</head>
<body>
I'm a 
<select name='gender' id='malefemale' onChange="selectGender(this.value, 'heshe');">
  <option value='0'>Male</option>
  <option value='1'>Female</option>
</select>.<br />
<p>
<select name='gender' id='heshe' onChange="selectGender(this.value, 'malefemale')">
  <option value='0'>He</option>
  <option value='1'>She</option>
</select>
 wrote this paragraph.</p>
</body>
</html>

that's not really what the OP was asking for.

Also, if you truly wanted to do it in javascript, you could easily perform this with JQuery, but since they asked in the PHP forum, use my post above.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.