Jump to content

Ell20

Members
  • Posts

    337
  • Joined

  • Last visited

    Never

Everything posted by Ell20

  1. Hi, I have a simple checkbox for the user to say whether or not their club has a pavilion. Once this has been stored I would like the page to check the database to see whether or not the checkbox should be checked. I tried <input type="checkbox" name="pavilion" value="<?=$pavilion?>" /> But this didnt work, is there anyway I can store a simple "Yes" to the database once ticked and then make the box ticked each time the user views the page? Thanks
  2. Not to worry, solved my own error needed to add: $order = ($_POST['order']); Thanks for your help!
  3. I think im nearly there but having a bit of trouble. I want to preset the table so that when you view the page it orders by date ASC, then when you use the filter it filters by what ever you wish but im not really sure how to do that. I have tried presetting the values like so: $filter = 'date'; $order = 'ASC'; Then if they filter: if (isset($_POST['submit6'])) { $order = $order; $filter = $filter; } The SQL here? Thanks
  4. I kind of get what your saying but can the $filter and $order be drop down boxes that the user can select from? Thanks
  5. Hi, I currently have a fixtures table which displays all the fixtures automatically in ascending order for date when the page is loaded. This is exactly what I want to begin with but I would also like to add a filter (think this is right word?) so that the user could then order the results how they wish for example by Team Ascending or Date Descending or Venue Home. Appreciate any help on adding this to my page. Elliot
  6. thanks very much for your help, solved!
  7. So something like this: $mailtext = htmentities(ENT_QUOTES($_POST['chat'])); Thanks
  8. Hi, I have a messaging system where players can message each other in the game. However if a player sends a message which contains --> there inbox dosent display correctly. The code which sends the message to the database is: $mailtext = addslashes(strip_tags($_POST['chat'])); Has anyone got any idea what I can do to stop this happening? I have tried: - $mailtext = stripslashes(strip_tags($_POST['chat'])); - $mailtext = stripslashes(trim($_POST['chat'])) But none of these combinations solved the problem. Thanks for any help Elliot
  9. Solved, I wasnt expecting it to be that as its not even in the same statement. Ive taken it out and also tinkered in other places, is it ok to remove ob_end_clean();? Cheers
  10. Anyone got any ideas on this? Ive been playing around but cant get the message to display on the index.php page like the other error messages in the code. Thanks
  11. Getting there, that solves the "Back" issue, is there anyway to get the error message to display on the same pages rather than a plain white page? Thanks
  12. Thanks for your help. It works - ish. I get the error message when I try and log in with an account with validate = 0 however if I click the "Back" button in the browser it logs into the account? Also is there anyway in which I can get the message to display on the login page simular to the way the "The username and password do not match" message does? Thanks again
  13. Sounds like you need to set up a session when a user logs in which would hold there user_id
  14. I kind of understand what your saying but not 100% would you be able to expand a bit please? Thanks
  15. Hi, I had a working registration page however I decided that I didn't want the user to be able to login unless the Administrator has accepted. I added a new field to the users table called validate, this is pre-set as 0 on registration, then once accepted an UPDATE statement is used to change it to 1. My problem comes when logging in, I have obviously had to adapt my login page to mirror the changes. I have it working in that if validate = 1 they can login and if validate = 0 they cant but I have so far failed in creating a error message to display on screen saying "You were could not be logged in because your account has not yet been accepted" Here is my code: /* If username and password entered query database to check they match in database */ if ($u && $p) { $query = "SELECT user_id, club_id, validate FROM users WHERE username='$u' AND password=PASSWORD('$p') AND validate = '1'"; $result = @mysql_query($query); $row = mysql_fetch_array ($result, MYSQL_NUM); /* If they match create session */ if ($row) { $_SESSION['user_id']=$row[0]; $_SESSION['club_id']=$row[1]; ob_end_clean(); /* Redirect to main.php when logged in */ header ("Location: http://" .$_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "main.php"); exit(); } else { echo '<p><font color="red" size="+1">The username and password do not match</font></p>'; } mysql_close(); I really appreciate any help
  16. Hi, I have a couple of drop down boxes which you select the option you want, that value is then stored in the database. If you make a mistake there is an edit option which once clicked shows the form with the information filled in/selected. However my problem is that when you edit, although the current option which was previously entered into the drop down box is set as the starting value, which is disabled, if you dont change the drop down box the value is deleted rather than held as it hasnt changed. I hope this makes sense, but here is some snippets of the code to try and explain what im talking about: Drop down box code: <select name="by2"><option value='' selected disabled> <?php if(isset($wr)) {?> <?=$wr?> <?php } if ($wr == "") { echo 'Wickets/Runs'; } ?> </option> <option value="Wickets">Wickets</option> <option value="Runs">Runs</option> Thanks for your help
  17. Excellent, thanks alot, you answered my next question without me even asking it, genius
  18. Yeah a cron is the answer. If you have a webhost, go to the control panel and the chances are they will have a option for Cron Jobs. The way it works is that you create the code, just like a PHP file then set the Cron Job to execute this file once an hour. Did my first cron yesterday and its working perfectly
  19. Hi, Im attempting to make a link which when clicked gets the data for a specific result then displays the results, I have done a couple before but for some reason this one isnt working: Link Code: <a href='<?=$_SERVER['PHP_SELF']."?result_id=$resultid";?>&mode=view'>View</a> Code to execute when link is pressed: <?php if ($_GET['mode'] == "view"){?> [color=red]= line 224[/color] etc etc <?php } ?> The error I have is displayed on the screen all the time, its not even when I click View: An error occured in script /home/mysport/public_html/results.php on line 224: Undefined index: mode Thanks for your help
  20. Hi, Im working on a sports club website. I have currently coded a fixtures.php page which displays the fixtures with date, time, opponents etc. Im now looking to code the results page, however the idea I have is that if the date of the fixture has passed, remove it from the fixtures list, automatically, and place it in the results page, which from here the administrator would be able to include a match report etc. Is there anyway in which this can be done? Thanks
  21. Ell20

    Code Help

    The following scenarios could occur: Never will all 3 options be selected as it is impossible to be both captain and vice - captain. Any combiniation of 2 of the boxes can be selected other than captain and vice captain selected. Any single selection box can be selected. All selection boxes can be blank Cheers
  22. Ell20

    Code Help

    Thats because I cut out the bits that are neccessary with this problem. The rest of the code is all working fine and is linked to other parts of the page which dont concern the error. Thanks
  23. Ell20

    Code Help

    The html selection boxes in the form: <tr> <td> Captain: </td> <td> <input type="checkbox" name="captain" value="Yes" /> </td> </tr> <tr> <td> Vice Captain: </td> <td> <input type="checkbox" name="vicecaptain" value="Yes" /> </td> </tr> <tr> <td> Wicketkeeper: </td> <td> <input type="checkbox" name="wicketkeeper" value="Yes" /> </td> </tr> <?php if (isset($_POST['submit2'])) { $captain = escape_data($_POST['captain']); $vice_captain = escape_data($_POST['vicecaptain']); $wicketkeeper = escape_data($_POST['wicketkeeper']); ------etc---------- $query = "INSERT INTO team_selection (club_id, fixture_id, player_name, captain, vice_captain, wicket_keeper) VALUES ('$id', '$fixture_id', '$name', '$captain', '$vice_captain', '$wicketkeeper')"; $result = @mysql_query ($query); if ($result) { echo '<h3>Player Added To Team Selection!</h3>'; ?> The reason I think it dosent work is because the variable is not defined if the selection box is not ticked? However I dont have a solution to get around this problem? Cheers
  24. Hi, Im creating a sports website where team selection can be added to the fixture. In my team selection table I have the options: Captain, Vice-Captain and Wicketkeeper. They are 3 seperate tick boxes. If all 3 of these tick boxes are selected then the code works perfectly, this however is unreleastic. If any of the selection boxes are not ticked I recieve the following errors: The easy soultion to this problem would be to add 2 tick boxes for each of the catergories so that the user either selections Yes Or No. However this is not how I want to do it as I want the user to do as little as possible. Also by having a Yes/No tickbox option the value "No" will be placed all over the team selection table whereas I would just like the table to display the value Yes where it is true and leave it blank where it would normally say "No". Can anyone offer a suggestion as to how I would go about doing this? Thanks Elliot
×
×
  • 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.