0
    <td width="186" align="right"><label for="collegetxt"></label>
  <select name="collegecategory"  dir="rtl" id="collegecategory" class="title">
                <option value="-1">Choose college</option>
              <?php

                $rs=$db->GetAllCollegCategory();
                while(list($name)=mysql_fetch_array($rs)){
                    echo "<option ".($collegSearch==$name?" selected=selected ":"")." value='$name'>$name</option>";
             } ?>

        </select>
        </td>

      </tr>
      <tr>
      <td> <strong>Teacher Number:</strong></td>
      <td width="217" align="right"><label for="Teachesearch"></label>
        <label for="TeacherNo"></label>
        <input type="text" name="TeacherNo" id="TeacherNo" class="title" checked="checked"/></td>
        <input type="submit" name="evlBtn1" id="evlBtn1" value="Evaluate" style="width:119px;height:39px;font-size:16px;" />

Hi,
i don't know how to keep the <input type="text"/> selected whenever i've pressed the Evaluate button
as the <select> value above was seleced ?!!

how can i keep it checked or selected..?!!

3
Contributors
5
Replies
28
Views
4 Years
Discussion Span
Last Post by Zagga
0

Would it be possible to see all your code for this? I'm a bit rusty on my PHP but want to try to help.

0

Hi,

At the top of the page, create a blank variable $teacherNo. Check if the form field has been filled in, if it has set it as the $teacherNo variable.

<?php
$teacherNo = "";
if (isset($_POST['TeacherNo'])){
<?php
$teacherNo = "";
if (isset($_POST['TeacherNo'])){
    $teacherNo = $_POST['TeacherNo'];
}
?>

Then in your form, echo the variable

<input type="text" name="TeacherNo" id="TeacherNo" class="title" checked="checked"/><?php echo $teacherNo; ?></td>

(Or is that supposed to be a checkbox input, not text?)

<?php
$che = "";
if (isset($_POST['TeacherNo'])){
    $che = "checked='checked'";
}
?>
<input type="checkbox" name="TeacherNo" id="TeacherNo" class="title" $che/></td>

Edited by Zagga

0

I attached snap shot, what i did mean in my question is how i can save the field value slected after clicking on the Evaluate button!

as you can see the year field and college field value has stilled selceted, how can i did this to the teacher number field??!!

Attachments jhn.PNG 5.31 KB
0

oh! i figure it out

thank you all :D

  <input type="text" name="TeacherNo" id="TeacherNo" class="title" value="<?php echo $techerS; ?>" checked="checked"/></td>

i've put the echo at the value""

0

Glad you figured it out.
As a side note, checked="checked" in a text input box does nothing. It is only used in checkbox inputs.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.