Please help
I am stuck on how to click checkbox and put area code in textfield

<?php $array1 = array("(516)","(631)","(718)"); ?>
<?php $AreaCode = $array1; ?>
<td><input name="Phone" type="text" value="<?php echo $array1[0] ?>" size="15" />
<input name="RadioGroup1" type="radio" id="RadioGroup1_0" value="<?php echo $array[0]; ?>" checked="checked" />
<label>(516)</label>
<input type="radio" name="RadioGroup1" id="RadioGroup1_1" value="<?php echo $array[1]; ?>" />
<label>(631)</label>
<input type="radio" name="RadioGroup1" id="RadioGroup1_2" value="(718)" />

Recommended Answers

All 2 Replies

If you are wanting the area code to enter into the textbox after a click, use the onclick event (JavaScript).

Still dont work

<?php $array1 = array("(516)","(631)","(718)"); ?>
<td><input name="Phone" type="text" value="<?php echo $array1; ?>" size="15" />
<input name="RadioGroup1" type="radio" id="RadioGroup1_0" onclick="<?php echo $array[0]; ?>" value="" checked="checked" />
<label>(516)</label>
<input name="RadioGroup1" type="radio" id="RadioGroup1_1" onclick="<?php echo $array[1]; ?>" value="" />
<label>(631)</label>
<input name="RadioGroup1" type="radio" id="RadioGroup1_2" onclick="<?php echo $array[2]; ?>" value="" />
<label>(718)</label><br />
<label>(###)###-####</label>
</td>

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.