Jump to content

vbcoach

Members
  • Posts

    129
  • Joined

  • Last visited

Everything posted by vbcoach

  1. Hello Psycho, thanks for your very quick response. I know my code is older, but I inherited it. As I try to wrap my head around what you wrote, one thing that was apparent as I entered the code was the HTML portion seems to be mission some type of variable statement. The <select name="size" id="size"> <?php echo ; ?> </select> is not actually echoing anything. What's missing here?
  2. Hello all. I am having an issue displaying data in a form that IF EXISTS (not blank) will cause that option to be selected. The looping itself works. The variable called into the form works. Just can't seem to get the form to SELECT the correct variable. <select name="size" id="size"> <?php while ($lrow = mssqlfetchassoc($tres)) { ?> <option value="<?php echo $lrow['ts_id'];?>"> <?php if($lrow['tsdescription'] == $info['size']) echo 'selected';?> <?php echo "$lrow[tsdescription]";?> </option> <?php } ?> </select> So this is displaying the team captain's TShirt size from a database (mssql). In the database the field is called tsdescription. For sake of argument, let's say the tshirt description is "Blue 2XLarge". This variable exists and is passed into the form for updating by the team captain, if necessary. The loop works, as it loops through all the tshirt options (107 in total) and works as a pull-down menu. Somehow my IF statement doesn't work. What I am looking for is for PHP to "find" the existing tshirt description 'tsdescription' in the loop statement, and if found, cause it to be "Selected". The $info are the variables for the form when the captain's information page is loaded. So far, by itself, the $info['size'] returns the correct tshirt. "by itself" the dropdown works. Thus, something must be amiss in my IF statement. Can anyone help direct me to what I am missing to make this work? Thanks in advance. -J
  3. It took a lot or research and editing, but I found my answer. Thanks all.
  4. Let me try this again. In the middle of my page, there is a form statement that creates buttons to push. I would like to create an "IF" statement to display or not display these buttons. In my code I use "session" but it really means "season" as in Spring or Summer. So if the "season" = Summer, then display these buttons. The basic code for these buttons looks like this: <?php if($row['ptsordered'] == '') { ?> <form name="player<?= $row['p_id'] ?>" action="editPlayer.php" method="get"> <input type="hidden" name="p" value="<?= $row['p_id'] ?>"> <input name="Submit" type="submit" class="button" value="Edit"> </form> <?php } ?> </td> <td><form name="del_player<?= $row['p_id'] ?>" action="remPlayer.php" method="post" onSubmit="return(confirm('Are you sure you want to delete <?= $row['name']?>?\n\nThis cannot be reversed'))"> <input type="hidden" name="p" value="<?= $row['p_id'] ?>"> <input type="hidden" name="t" value="<?= $id ?>"> <input name="Submit" type="submit" class="button" value="Remove"> </form></td> </tr> <?php $i++; } ?> So I need help with a PHP statement that says if "session = 'Summer" then ..." displays the buttons, if not, the buttons are not displayed. Does this make sense now? Sorry for the confusion.
  5. Hello all. I have a sports league website that is used for captains to be able to view and manipulate certain items displayed in a form format. I want to be able to hide or disable two buttons in the form; the Edit and Remove buttons based on a simple IF statement. However I am not quite being able to make this happen, as the form is outside of the PHP statement. <body> <table width="800" border="0" cellpadding="0" cellspacing="0"> <tr> <td><img src="images/BBV_CP_top.jpg" width="800" height="200"></td> </tr> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td width="6%" class="menu"><a href="home.php"> Home</a> </td> <td width="9%" class="menu"> <?php if {echo "<a href=editTeam.php> Edit Team </a>";}?></td> <td width="12%" class="menu"> <?php if ($team[session] == 'Summer') {echo "<a href=addPlayer.php> Add Player </a>";}?></td> <td width="63%" class="menu"><br> <?php if ($team[session] == 'Summer') {echo "<a href=editInfo.php> Edit My Information </a>";}?></td> <td width="10%" class="menu"><a href="logout.php">Log Out </a></td> </tr> </table></td> </tr> <tr> <td><table width="765" border="0" cellspacing="1" cellpadding="1"> <?php if($info['feepaid'] == 'n') { ?> <tr> <td colspan="2" align="left" valign="top"> </td> </tr> <?php }?> <tr> <td width="37%" align="left" valign="top"><br> <table width="100%" border="0" cellpadding="2" cellspacing="0" class="grey2px"> <tr> <td colspan="2" class="dk_greyTxt"><h3><strong>Captain's Information</strong></h3></td> </tr> <tr> <td width="27%" class="dk_greyTxt"><strong>Name</strong></td> <td width="73%"><?php echo $info['cptname']; ?> </td> </tr> <tr> <td class="dk_greyTxt"><strong>Address</strong></td> <td><?php echo $info['address']; ?><br> <?php echo "$info[city], $info[state] $info[zip]"; ?> </td> </tr> <tr> <td class="dk_greyTxt"><strong>Phone</strong></td> <td><?php echo $info['phone'] ?></td> </tr> <tr> <td class="dk_greyTxt"><strong>E-mail</strong></td> <td><?php echo $info['email'] ?></td> </tr> <tr> <td class="dk_greyTxt"><strong>Shirt Size </strong></td> <td><?php echo $info['size'] ?></td> </tr> </table> <br></td> <td width="63%" rowspan="2" align="left" valign="top"><br> <table width="100%" cellpadding="1" cellspacing="0" class="grey2px"> <tr class="dk_greyTxt"> <td colspan="6"><h3><strong>Player's Information</strong></h3></td> </tr> <tr class="dk_greyTxt"> <td width="21%"><strong>Name</strong></td> <td width="23%"><strong>E-mail</strong></td> <td width="21%"><div align="center"><strong>Shirt Size</strong></div></td> <td width="19%"> </td> <td width="16%"> </td> </tr> <?php $i=0; while($row = mssqlfetchassoc($players)) { ?> <tr <?php if($i%2 == 0) echo "class='altbg'";?> > <td><?php echo $row['name'] ?></td> <td><?php echo $row['email'] ?></td> <td align="center"><?php echo $row['pshirt'] ?></td> <td><form name="del_player<?= $row['p_id'] ?>" action="remPlayer.php" method="post" onSubmit="return(confirm('Are you sure you want to delete <?= $row['name']?>?\n\nThis cannot be reversed'))"> </form></td> <td><form name="player<?= $row['p_id'] ?>" action="editPlayer.php" method="post"> </form></td> </tr> <?php $i++; } ?> </table></td> </tr> <tr> <td align="left" valign="top"><br> <table width="100%" border="0" cellpadding="2" cellspacing="0" class="grey2px"> <tr> <td colspan="2" class="dk_greyTxt"><h3>Team Information </h3></td> </tr> <tr> <td width="27%" class="dk_greyTxt"><strong>Name</strong></td> <td width="73%"><?php echo $team['teamname']; ?></td> </tr> <tr> <td class="dk_greyTxt"><strong>League</strong></td> <td><?php echo "$team[night] $team[type] $team[size]s"; ?></td> </tr> <tr> <td class="dk_greyTxt"><strong>Division</strong></td> <td><?php echo $team['division'] ?></td> </tr> <tr> <td class="dk_greyTxt"><strong>Shirt Color </strong></td> <td><?php echo $team['shirtcolor'] ?></td> </tr> <tr> <td class="dk_greyTxt"><strong>Registration Date </strong></td> <td><?php echo $team['reg_start'] ?></td> </tr> <?php if($info['feepaid'] == 'n') { ?> <?php } else { ?> <tr> <td class="dk_greyTxt"><strong>Registration Completed </strong></td> <td><?php echo $team['reg_done'] ?></td> </tr> <?php } ?> <?php mssqlclose(); ?> <tr> <td class="dk_greyTxt"><strong>Record </strong></td> <td> </td> </tr> </table></td> </tr> </table></td> </tr> </table> <br> </body> Under the Players table, there is an Edit and Remove button. I would like to hide this button based upon a PHP statement that looks a bit like this: <?php if ($team[session] == 'Summer')... Basically we are in the Spring session, thus at this point in the season, I do not want teams to be able to edit, add, or remove any player information. However the same database is used for both Spring and Summer registrations. So any help incorporating this php statement to hide these buttons would be greatly appreciated! -J
  6. Well these are all great ideas, but this doesn't help me with my initial query
  7. Is this a diagram of a "view"? Tried to create a database without the captain table, but a captain on one team can be a captain of other teams in other league nights, and still players on yet other teams. Never found a good way around this.
  8. Hello all. I could use some ms sql assistance. You see, I have a sports league that has various tables. I want to draw different information out of two tables; captain and player. Every team has a captain and multiple players. Each captain and player has shirt options. They choose their own shirt size and color. In the database under the captain’s table are columns for the tshirt description called “shirtsize”, and an associated TShirt ID number called “shirt_id” Under the players table are similar columns; pshirt and pshirt_id, respectively. I am not good with joins, so I could use some assistance getting a total shirt count of similar shirt_id’s from both tables. Captain’s shirt_id + player’s pshirt_id = total shirt_id counts. The results would look something like this: - Shirt - (ID) (Count) Unisex Small Hot Pink 1 3 Unisex Medium Hot Pink 2 8 Unisex Large Hot Pink 3 6 Unisex XLarge Hot Pink 4 2 Unisex Small Kelly Green 7 1 Unisex Medium Kelly Green 8 7 Unisex Large Kelly Green 9 8 Unisex XLarge Kelly Green 10 2 Unisex 2XLarge Kelly Green 11 1 Unisex Small Light Blue 13 4 Unisex Medium Light Blue 14 8 Unisex Large Light Blue 15 10 I can write this statement for one table (i.e.captain’s table) but can’t seem to merge the two tables for total shirt count. Anyone have any idea?
  9. Let's get one more thing straight! I use this forum for two purposes: To ask for help with an issue that I cannot otherwise figure out for myself, and to actually "learn" something along the way. These two go hand-in-hand. My request was simple, and I appreciated all the help along the way. Yet when I take someone's "suggestion" which is incomplete or doesn't work for me - and then ask for additional assistance as to "why", I really don't take kindly to what you call "unproductive" answers. I have shown my code all along, and simply asked for assistance in WHERE to place the suggested item responses I received here to make it all work. As stated, I tried myself in what I considered 'logical locations' but I am not an expert coder, or I wouldn't be here. Guru, you could have easily answered my question rather than this bickering and bantering back and forth. I love this place. Been here for years. Fortunately I do not have to come here all that often, but when I do - it is because I am "stuck" on something and really need some guidance - and yes at times to have someone write their suggestions for me into a usable code (my code) so I can figure out why mine didn't work, and what the proper method was. That was my intent here. A simple "I would placed this code 'here' inside your code" would have sufficed. To date, no one has actually directed me at to where this simple suggestive code should be placed. Now is that really this difficult? You could have also placed this in a private message versus blabbing this to the entire PHPFREAKS world. Now that is not good for either of us.
  10. Since you are either unable or unwilling to help, and it's been 3 days now, please close this topic as UNSOLVED and UNANSWERED. I had to spend hours manually entering this data into separate, new columns, just so it would display properly.
  11. I am not a coder by trade. I placed it in what seemed to be the most logical places, and it did not work. Also guru mentioned that the "case" convention you gave me would not work as written. Not trying to be a pita here, but statements like yours for someone reaching out for help is very frustrating.
  12. By the way, I am also just using DreamWeaver to code and upload to the server. We are using a 3rd party shared hosting provider, thus we have virtually zero access to anything other than uploading edited pages. Not the best solution, obviously, but it's what we have to work with for now. So for now, Twig is out for me I have a relatively simple pull-down option statement: <select name="ret_teamname" id="ret_teamname" tabindex="4" > <option value="" selected="selected">-- Select Returning Team --</option> <?php while ($lrow = mssqlfetchassoc($rres)) { ?> <option value="<?php echo $lrow['l_id'];?>"><?php echo "$lrow[season] $lrow[leaguename] $lrow[rteamname] $lrow[firstname] $lrow[lastname]"; ?></option> <?php } ?> </select> ... that needs to be able to display properly the manipulated strings. ANYONE PLEASE?
  13. Well, great idea - and I am always open to doing things an easier way. However your statement above absolutely doesn't work - at least not in my environment. It has no idea what 'member.' is, or how this is defined. It also eliminated my "<?php while ($lrow = mssqlfetchassoc($rres)) { ?>" loop. I'm lost here.
  14. By the way, I do not actually need the identifiers like "season" or "teamname" to preceed the output. For my team captains who will be seeing this information, it's already self-explanatory. Besides, I have limited space in the webform for the output - hence the need to limit the size of the teamname. Thanks!
  15. Thanks for the replies, but I need to know "WHERE" to place the code that does the string length cutting! Places I have logically placed this code is simply not working.
  16. I could use some help here. I was unable to get any variable to echo without the $lrow[ ] statement. Right now my code looks like this: <?php while ($lrow = mssqlfetchassoc($rres)) { ?> <option value="<?php echo $lrow['l_id'];?>"><?php echo "$lrow[season] $lrow[league] $lrow[rteamname] $lrow[firstname] $lrow[lastname]; ?></option> How would the above statement look and be placed inside of this code? Thanks!
  17. Hello all. I have a sports league database where when a team registers as a “returning team” from last year, it queries a table that contains the basic information from last year’s team names, league, night and division. Simple enough. However I would like to do two things to the data in the array. First, I want to take two fields ‘firstname’ and ‘lastname’ and create an output that lists only the first character of the ‘firstname’, add a dot, then the ‘lastname’ i.e. J. Doe as the output. Second, I want to limit the number of characters in the ‘teamname’ field to no more than 25 characters, and if it’s over 25 characters, limit the output to 25 characters then 3 dots ‘…’ For example if the teamname was “Twenty Five Crazy Characters Team” it would be cut to “Twenty Five Crazy Charact…” to limit the size of the field I am using. I basically only have 5 strings I am working with. “season” “league” “teamname” and “firstname” and of course “lastname”. I am simply having the hardest time manipulating the array data to output as I have written above. I have hit a wall here. Was hoping some type of substr() statement would help, but alas it is not working. PHP coders, I NEED YOUR HELP! Thanks in advance! <select name="ret_teamname" id="ret_teamname" tabindex="4" > <option value="" selected="selected">-- Select Returning Team --</option> <?php while ($lrow = mssqlfetchassoc($rres)) { ?> <option value="<?php echo $lrow['l_id'];?>"><?php echo "$lrow[season] $lrow[leaguename] $lrow[rteamname] $lrow[firstname] $lrow[lastname]"; ?></option> <?php } ?> </select>
×
×
  • 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.