Jump to content

xwielder

Members
  • Posts

    11
  • Joined

  • Last visited

About xwielder

  • Birthday 07/16/1973

Profile Information

  • Gender
    Male

xwielder's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Fair enough. I've opted to do the following: My "skill_array.txt" file is now "skill_array.php". Here is that file now: <?php $selects = array(0 => '-skill-' ,1 => 'Assassin (basic)' ,2 => 'Assassin (intermediate)' ,3 => 'Assassin (advanced)' ,4 => 'Hand to Hand (basic)' ,5 => 'Hand to Hand (intermediate)' ,6 => 'Hand to Hand (advanced)' ,7 => 'Martial Arts (basic)' ,8 => 'Martial Arts (advanced)' ,9 => 'Martial Arts (intermediate)' ); ?> And now in my "file.php" file: <?php include("skill_array.php"); ?> Everything works great. I'm not sure why "$selects = array(file_get_contents("skill_array.txt"));" doesn't, as you say, "work like that", but if it doesn't it doesn't. Thanks for your help and advice!
  2. In my "skill_array.txt" file I have: 0 => '-skill-' ,1 => 'Assassin (basic)' ,2 => 'Assassin (intermediate)' ,3 => 'Assassin (advanced)' ,4 => 'Hand to Hand (basic)' ,5 => 'Hand to Hand (intermediate)' ,6 => 'Hand to Hand (advanced)' ,7 => 'Martial Arts (basic)' ,8 => 'Martial Arts (advanced)' ,9 => 'Martial Arts (intermediate)' In my "file.php" file, I have: <?php $selects = array(file_get_contents("skill_array.txt")); print("<pre>"); print_r($selects); print("</pre>"); /* This is what I get */ /* Array ( [0] => 0 => '-skill-' ,1 => 'Assassin (basic)' ,2 => 'Assassin (intermediate)' ,3 => 'Assassin (advanced)' ,4 => 'Hand to Hand (basic)' ,5 => 'Hand to Hand (intermediate)' ,6 => 'Hand to Hand (advanced)' ,7 => 'Martial Arts (basic)' ,8 => 'Martial Arts (advanced)' ,9 => 'Martial Arts (intermediate)' ) */ ?> Why doesn't it parse it like I'm wanting? I want the print_r to show: /* Array ( [0] => -skill- [1] => Assassin (basic) [2] => Assassin (intermediate) [3] => Assassin (advanced) [4] => Hand to Hand (basic) [5] => Hand to Hand (intermediate) [6] => Hand to Hand (advanced) [7] => Martial Arts (basic) [8] => Martial Arts (advanced) [9] => Martial Arts (intermediate) ) */
  3. @ManiacDan - All I said was thank you for your suggestion. It was sound advice. @mjdamato - Although your comment has nothing to do with the posted issue, you offer good advice to the person that would actually do what you're assuming I'm doing in a live environment. I'm not, but I do understand your concern. Anyway... this is working great: <?php if (isset($_POST['submit'])) { $optionArray = preg_split("/;/", $_POST['subscriptionLevel']); $mySession->setSessionVars("SUBLVL", $optionArray[0]); $mySession->setSessionVars("SUBLVLPRICE", $optionArray[1]); $mySession->setSessionVars("SUBLVLPRICETERM", $optionArray[2]); $mySession->setSessionVars("SUBLVLPRICETERMREC", $optionArray[3]); } ?> <html> <body> <form name="form" method="post" action=""> <table> <tr> <td> <label for="subscriptionLevel"></label> <select name="subscriptionLevel" id="subscriptionLevel"> <?php do { ?> <?php $theValue = $dbRowResult['sub_level'] . ";" . $dbRowResult['sub_price'] . ";" . $dbRowResult['sub_price_term'] . ";" . $dbRowResult['sub_price_term_rec']; ?> <option value="<?php echo $theValue; ?>"<?php echo ($dbRowResult['sub_level'] == '0' ? " selected":""); ?>><?php if ($dbRowResult['sub_level'] == '0') { echo $dbRowResult['sub_price']; } else { echo ($dbRowResult['sub_price'] . " " . $dbRowResult['sub_price_term'] . " (" . $dbRowResult['sub_price_term_rec'] . ")");} ?></option> <?php } while ($dbRowResult = $db->dbGetRow($dbQueryResult)); ?> </select> </td> <td> <label> <input type="submit" name="submit" id="submit" value="submit"> </label> </td> </tr> </table> </form> </body> </html> Again, thank you. Everything's working perfectly.
  4. Okay, I'll use a delimeted concatenated value to parse thru. Too bad the $_POST array doesn't contain all attributes and/or children of html tags. Thanks for the suggestion.
  5. <?php if (isset($_POST['submit'])) { // Grab the selected value $optionValue = $_POST['subscriptionLevel']; // Grab the id of the selected value ** HOW DO I DO THIS? ** $optionID = ?????????????????????????; } ?> <html> <body> <form name="form" method="post" action=""> <table> <tr> <td> <label for="subscriptionLevel"></label> <select name="subscriptionLevel" id="subscriptionLevel"> <?php do { ?> <option id="<?php echo $dbRowResult['sub_level']; ?>" value="<?php echo $dbRowResult['sub_price']; ?>"><?php echo $dbRowResult['sub_desc']; ?></option> <?php } while ($dbRowResult = $db->dbGetRow($dbQueryResult)); ?> </select> </td> <td> <label> <input type="submit" name="submit" id="submit" value="submit"> </label> </td> </tr> </table> </form> </body> </html> How do I grab the id of the selected value? Thank you.
×
×
  • 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.