Jump to content

jwmiller

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jwmiller's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Looking for someone that has used a good report writter (dataminer) that we can link to mysql database. Also any tips would be wonderfule
  2. HA, got it THANK YOU SO MUCH. This was the piece of the puzzle I needed. This was my final echo option statement echo '<option value="'.($row['stateid']).'"'.(($row['stateid'])==$studstate ? 'selected="1"':'').'>'; and it is exactly what I needed. So How do I mark this as solved?
  3. I ran your code and that is exactly what I need to happen, however I am stuck trying to translate the way you wrote your code to my way So if I have the variable returned $studstate (this has OH stored in this field in the students table and I returned that text and stored it in $studstate) I am also getting the table from the states table and returning as an array See below How do I translate your option set up : foreach ($a as $k => $v ) echo '<option value="'.$k.'"'.($k == $c ? ' selected="1"':'').'>'.$v.'</option>'; to minic my set up below. That is now where I am stuck. I am getting confused between my [] and your => as well as where exactly I can place -- as well as create the ($row==$studstate ? selected ) statement $studstate='OH' foreach ($state_array as $row) { echo "<option value=\"".($row['stateid'])."\""; // if existing state, put in current catgory echo "<strong> ".($row['stateid'])."</strong><br />"; }
  4. Thank you for your reply, I am still not real clear but I will copy your code and see if I can make it work - so i can understand your logic. I was not real clear in MY coding - the OH is really coming over as a variable $studstate - I just hard coded it in the loop to see if I could get anything to default to the information that is already stored in the students database. Thanks again
  5. I have a simple form that edits student information. I have several fields that I have a drop down list pulled as an array from a separate table. I would like the information that is already entered on the student to be the default but still have the drop down list available if the item was entered in error. For example: Drop down list of all the states of America, OH was entered for the student, when the edit form comes up for State in Address I would like OH to be the default but still have the list to choose if OH was entered in error. I have tried selected = $selected but then the entire drop down changed to OH. I am very, very much a beginner in this <?php // list of possible modules comes from database $state_array=get_states(); //display as a drop down list for end user to choose if (!is_array($state_array)) { echo "<p>No States are currently available<p>"; return; } foreach ($state_array as $row) { echo "<option value=\"".($row['stateid'])."\""; // if existing state, put in current catgory echo "<strong> ".($row['stateid'])."</strong><br />"; echo "<option select=\"selected\">OH"; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.