question about displaying select and radio button

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi

i have registration form where user selects from a drop down to 
select their area code apart from filling other details in the form. 
in the next page which is a confirmation page i would like to 
display the select option that a user choose in the first page i am 
able to display this using a textfield however i would like to 
display using the select drop down.

following is the code for both select and radio button that i have 
used.

1. Select tag

$pcontactnumber = addslashes($_POST["pcontactnumber"]);

<select name="pcontactnumber">
<option value="09">   <?php if $pcontactnumber == "09"  
echo "selected" ?>09</option>
<option value="07">   <?php if $pcontactnumber == "07"  
echo "selected" ?>07</option>
</select>

2. radio button
<script language="javascript">

var m = document.confirmregistrationform.gender.Male.checked;
var f = document.confirmregistrationform.gender.Female.checked;
</script>

echo "<input type =\"radio\"  name=\"gender\" value=\"Male\"   if
($gender=='Male') m // Male";
echo "<input type =\"radio\"  name=\"gender\" value=\"Female\" if
($gender=='Female') f // Female";

2. radio button
echo "<input type =\"radio\"  name=\"gender\" value=\"Male\"   if
($gender=='Male')   {gender.checked}>Male";
echo "<input type =\"radio\"  name=\"gender\" value=\"Female\" if
($gender=='Female') {gender.checked}>Female";

please correct the code and provide the correct syntax to display 
the information for select tag and radio button in the confirmation 
page using php

also i have another question, how can i pass a variable to a php 
file when a user clicks on a link without submitting a form
Ex:
Please choose your user name <input type="text" name="username"> <a 
href="checkusername.php">check availability</a>

i have tried document.myform.submit(); onclick event for the <a> tag 
however it does not work

please advice.

thanks


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux