Jump to content

Daney11

Members
  • Posts

    301
  • Joined

  • Last visited

    Never

Everything posted by Daney11

  1. Hey guys, I am stuck on how to write this function. Basically i have a table 'ladder' and 'teams' In 'ladder' i have ladderid ladderteamid laddernumber in 'teams' i have teamid teamname I want a function to grab the name of the team 'teamname' from 'teams' however im selecting the team name like this.. $teamnameQuery = "SELECT * FROM `teams` WHERE `teamid` = $ladderteamid"; All the information on ladder.php is in ladder but the teamname is in a seperate table. Any other information you need ill post. Thanks in advanced Dane
  2. awesome, works a treat, thanks
  3. Lovely, Thankyou very much mate Dane
  4. Hi guys, i create a form and i want to add some if and else statments within the form when it gets submitted. This is the sort of thing i want to use, to display errors to the user when they submit the form but it displays the error as soon as the script is loaded. if (isset($_POST['mail_subject']) == "" ) { echo '<script type="text/javascript">alert("You Have Not Entered A Subject")</script>\n'; } if (isset($_POST['mail_body']) == "" ) { echo '<script type="text/javascript">alert("You Have Not Entered Any Text")</script>\n'; } else { if (isset($_POST['mail_subject'])) { $strQuery = "INSERT INTO mail_inbox ( mail_inbox_id, mail_inbox_manager_id, mail_inbox_from_id, mail_inbox_date, mail_inbox_time, mail_inbox_subject, mail_inbox_body, mail_inbox_type )"; $strQuery .= " VALUES ( 'NULL', '$_POST[mail_to]', '$_POST[mail_from_id]', '$date', '$time', '$_POST[mail_subject]', '$_POST[mail_body]', 'Manager Mail' )"; mysql_query($strQuery,$db) or die(mysql_error()); } } This is what i am using and it works perfect, it submits the data within the form. if (isset($_POST['mail_subject'])) { $strQuery = "INSERT INTO mail_inbox ( mail_inbox_id, mail_inbox_manager_id, mail_inbox_from_id, mail_inbox_date, mail_inbox_time, mail_inbox_subject, mail_inbox_body, mail_inbox_type )"; $strQuery .= " VALUES ( 'NULL', '$_POST[mail_to]', '$_POST[mail_from_id]', '$date', '$time', '$_POST[mail_subject]', '$_POST[mail_body]', 'Manager Mail' )"; mysql_query($strQuery,$db) or die(mysql_error()); } Any ideas please guys? Thanks a lot Dane
  5. So how do i go about inserting the data into the database? My form submits. But because im using if (isset($_POST[''])) { I dont know where to go from there then.... Thanks Dane
  6. Yeah, All my fields are named. And when i used a submit form at the end and submit my data it works perfect. However i dont want to use a button i want to use text "Send Mail" All my other forms are named.
  7. Ive tried using the javascript name ive used to submit the form but that aint working either. Any other ideas? Thanks
  8. What do you mean by element? Thanks again Dane
  9. Hi guys. Ive created a in website mail system for my website, however i am not using a button for the submit. I am using normal text and javascript to submit form which works fine BUT in order to insert the information into the database im using if (isset($_POST[''])) { Now if i was using a button to submit it and had the name as submit i would enter submit into the post area however im not using any names. How would i go about inserting the information into my database? Thanks Dane
  10. No worrys guys ive solved it. Anyone wondering how i just added <form> at the begining of <table> and </form> at the end of </table> Worked lol.
  11. I'm still having problems. <table width="320" height="450" cellpadding="0" cellspacing="0" align="center" class="outline"> <tr> <td width="120" height="20"> From:</td> <td width="200" height="20"> <?php echo $first_name ?>td> </tr> <tr> <td width="120" height="20"> To:</td> <td width="200" height="20"> <input type="text" name="mail_to" size="30" maxlength="30" class="shoutbox"></td> </tr> <tr> <td width="120" height="20"> Subject:</td> <td width="200" height="20"> <input type="text" name="mail_subject" size="30" maxlength="30" class="shoutbox"></td> </tr> <tr> <td width="120" height="20"> Date:</td> <td width="200" height="20"> <?php $date = date('d/m/Y'); $time = date('H:i:s'); echo $date; ?> <?php echo $time; ?></td> </tr> <tr> <td width="320" height="350" colspan="2"><textarea name="mail_body" cols="60" rows="20" class="shoutbox"></textarea></td> </tr> <tr> <td width="320" height="20" colspan="2" align="right">Send Mail </td> </tr> </table> The Javascript that i am using is <Script Language="JavaScript"> function mail_compose() { var load = window.open('compose.php','','scrollbars=no,menubar=no,height=450,width=320,resizable=no,toolbar=no,location=no,status=no'); } </Script> How would i make it so that the content fits perfectly into the newly opened javascript page.
  12. Hi Guys, My problem is that i have used a javascript open window command to open a new window with the pixels height=450,width=320. Then i have created a new page and entered a table with the pixels height=450,width=320. However when i open the window the page is not being viewed correctly. The pixels are are out by a few pixels from the right and the top. Any ideas on how to position my table correctly within the new opened window? thanks Dane
  13. Sorted, just had to move the select box around lol
  14. Hi guys. I have some information inside a database that i want to extract into a select form. <td width="163" height="20"> <?php $strQuery = "SELECT team_id, team_name FROM `teams` WHERE team_id > 0"; $result = mysql_query($strQuery,$db) or die(mysql_error()); while ($teamrow = mysql_fetch_array($result)) { $team_id = mysql_real_escape_string($teamrow['team_id']); $team_name = mysql_real_escape_string($teamrow['team_name']); ?> <select class="shoutbox" name="player_club" type="text" maxlength="10"> <option value="<?php echo "$team_id" ?>"><?php echo "$team_name" ?></option></select> <?php } ?> </td> This peice of code works, but extracts all the information in my database into a select box each, so i have over 100 select boxes, where i want all the names into one select box that you can select in the form and the team_id will be the value corresponding to the team name. Thanks guys Dane
  15. SOLVED All i had to do was add 0's into the blank spaces $bdayunix = mktime('0', '0', '0', $monthofage, $dayofage, $yearofage); Thanks for helping anyway mate Thankyou Dane
  16. Now i get this error Parse error: parse error, unexpected ',', expecting ')' in D:\server\age.php on line 19 lol
  17. I still get the same error mate
  18. Hi guys. I have <?php $daymin = "01"; $monthmin = "01"; $yearmin = "1971"; $daymax = "30"; $monthmax = "12"; $yearmax = "1991"; for ($i = 1; $i < 22; $i++) { $dayofage = mt_rand($daymin, $daymax); $monthofage = mt_rand($monthmin, $monthmax); $yearofage = mt_rand($yearmin, $yearmax); $bdayunix = mktime('', '', '', $monthofage, $dayofage, $yearofage); $nowunix = time(); $ageunix = $nowunix - $bdayunix; $age = floor($ageunix / (365 * 24 * 60 * 60)); echo "$dayofage $monthofage $yearofage Age - $age<br />"; } ?> And im getting the error Warning: mktime() expects parameter 1 to be long, string given in D:\server\age.php on line 19 It work on my other server but not this. Any help would be great. Thanks guys.
  19. Perfect cmgmyr Thankyou
  20. Thanks a lot. That works fine. Thanks again Dane
  21. My form is. <?php $name = "Dane"; $money = "1000000"; ?> <form action="player_money_create.php" method="post"> <table width="654" cellpadding="0" cellspacing="0" align="center" class="leagueoutline"> <tr> <td width="168" height="20" align="left" valign="middle"><?php echo " $name"; ?></td> <td width="168" height="20" align="left" valign="middle"><input class="shoutbox" name="money" type="text" value="<?php echo "$money" ?>" /></td> </tr> </table> <input name="givemoney" type="submit" class="shoutbox" onClick="return confirmMoney()" value="Click Here To Submit"> </form> Thanks
  22. Its not giving me the error anymore but its also not getting the values out of my form for some reason and all the names are correct :S
  23. Hi guys, I get this error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 When using <?php if (isset($_POST['givemoney'])) { $_GET['money']; $strQuery = "UPDATE `teams` SET money = '$money' WHERE player_id = $id"; mysql_query($strQuery,$db) or die(mysql_error()); } ?> and line 1 is <?php :S *** I get the error when i submit the form. Any ideas guys. Thanks
  24. <table><tr><td> </td></tr></table> If i add the form <form><table><tr><td> </td></tr></table></form> It gives 2 spaces at the top and bottom of my site. Where is the best way and how is the best way to add forms to your sites? Thanks Dane
  25. perfect, thankyou very much for helping me Dane
×
×
  • 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.