Jump to content

CMellor

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Everything posted by CMellor

  1. Hello all, First I'd like to point out that I'm new-ish to Javascript, I don't use it in big chunks, just small. I have made this function, check it out: function callPage(url) { Spry.Utils.setInnerHTML('blah', 'Loading...'); Spry.Utils.loadURL("GET", url, true, callHandle); } function callHandle(req) { Spry.Utils.setInnerHTML('blah', req.xhRequest.responseText); } I use an onClick with a Button to call it: <input name="button" type="button" onclick="callPage('spry_form.php?id=14');" value="Click" /> and the requested text appears here: <div id="blah"></div> I want to use this function more than once and would want to call a new DIV ID each time, but when I try this function: function callPage(url, div) { Spry.Utils.setInnerHTML(div, 'Loading...'); Spry.Utils.loadURL("GET", url, true, callHandle); } function callHandle(req) { Spry.Utils.setInnerHTML(div, req.xhRequest.responseText); } Along with this XHTML: <input name="button" type="button" onclick="callPage('spry_form.php?id=14', 'blah');" value="Click" /> When I click the button, it shows the 'Loading...' text, but doesn't request the file, it just says 'Loading...' all the time. As I stated I'm new-ish with Javascript and not sure what I may have done wrong with this function. If anybody can guide me in the right direction, I would be greatly appreciated, and it would help me a lot! Thanks for taking the time to read, and I look forward to a response, Chris.
  2. Hello, I have been trying to develop a bit of code to allow me to update a database field when an onChange occures on a drop down box. For some odd reason, it doesn't work at all, also I might add I am using Prototype. Here's my code: <script language="Javascript" type="text/javascript"> // Update roster brand function changeBrand(value, id) { new Ajax.Updater('div', 'js/brand.php?show=' + value + '&id=' + id); } </script> <?php // MySQL connect include('../../include/functions.php'); // connect connect(); if(!isset($_GET['show'])) { mysql_query("UPDATE ibf_members SET mgroup = '".$_GET['show']."' WHERE id = '".$_GET['id']."'"); } // close MySQL mysql_close(); ?> echo(' <form action="" method="post" name="form"> <select name="brand" onchange="changeBrand(document.form.brand.options[document.form.brand.selectedIndex].value, '.$row['id'].'); return false"> '); // query $group_query = mysql_query("SELECT * FROM ibf_groups, ibf_members WHERE ibf_groups.g_id = ibf_members.id AND g_id IN(3, 4, 6, 7)"); // fetch data while($groups = mysql_fetch_array($group_query)) { $selected = $row['mgroup'] == $groups['g_id'] ? 'selected' : ''; echo(' <option value="'.$groups['g_id'].'" '.$selected.'>'.$groups['g_title'].'</option> '); } echo(' </select> </form> <div id="div"></div> '); Does anything look wrong?
  3. Note, tried editing my last post but it wouldn't let me. Nevermind, figured it out *finally* If interested, here's the code: <select name="brand"> // query $group_query = mysql_query("SELECT * FROM ibf_groups, ibf_members WHERE ibf_groups.g_id = ibf_members.id AND g_id IN(3, 4, 6, 7)"); // fetch data while($groups = mysql_fetch_array($group_query)) { $selected = $row['mgroup'] == $groups['g_id'] ? 'selected' : ''; echo(' <option value="'.$groups['g_id'].'" '.$selected.'>'.$groups['g_title'].'</option> '); } </select> I just used a different query. Thanks for the help though Barand!
  4. Hmmm... am assuming you mean these, their pretty long: -- -- Table structure for table `ibf_groups` -- CREATE TABLE `ibf_groups` ( `g_id` int(3) unsigned NOT NULL auto_increment, `g_view_board` tinyint(1) default NULL, `g_mem_info` tinyint(1) default NULL, `g_other_topics` tinyint(1) default NULL, `g_use_search` tinyint(1) default NULL, `g_email_friend` tinyint(1) default NULL, `g_invite_friend` tinyint(1) default NULL, `g_edit_profile` tinyint(1) default NULL, `g_post_new_topics` tinyint(1) default NULL, `g_reply_own_topics` tinyint(1) default NULL, `g_reply_other_topics` tinyint(1) default NULL, `g_edit_posts` tinyint(1) default NULL, `g_delete_own_posts` tinyint(1) default NULL, `g_open_close_posts` tinyint(1) default NULL, `g_delete_own_topics` tinyint(1) default NULL, `g_post_polls` tinyint(1) default NULL, `g_vote_polls` tinyint(1) default NULL, `g_use_pm` tinyint(1) default '0', `g_is_supmod` tinyint(1) default NULL, `g_access_cp` tinyint(1) default NULL, `g_title` varchar(32) NOT NULL default '', `g_can_remove` tinyint(1) default NULL, `g_append_edit` tinyint(1) default NULL, `g_access_offline` tinyint(1) default NULL, `g_avoid_q` tinyint(1) default NULL, `g_avoid_flood` tinyint(1) default NULL, `g_icon` text NOT NULL, `g_attach_max` bigint(20) default NULL, `g_avatar_upload` tinyint(1) default '0', `prefix` varchar(250) default NULL, `suffix` varchar(250) default NULL, `g_max_messages` int(5) default '50', `g_max_mass_pm` int(5) default '0', `g_search_flood` mediumint(6) default '20', `g_edit_cutoff` int(10) default '0', `g_promotion` varchar(10) default '-1&-1', `g_hide_from_list` tinyint(1) default '0', `g_post_closed` tinyint(1) default '0', `g_perm_id` varchar(255) NOT NULL default '', `g_photo_max_vars` varchar(200) default '100:150:150', `g_dohtml` tinyint(1) NOT NULL default '0', `g_edit_topic` tinyint(1) NOT NULL default '0', `g_email_limit` varchar(15) NOT NULL default '10:15', `g_bypass_badwords` tinyint(1) NOT NULL default '0', `g_can_msg_attach` tinyint(1) NOT NULL default '0', `g_attach_per_post` int(10) NOT NULL default '0', `g_topic_rate_setting` smallint(2) NOT NULL default '0', `g_dname_changes` int(3) NOT NULL default '0', `g_dname_date` int(5) NOT NULL default '0', `g_blog_attach_max` int(10) NOT NULL default '-1', `g_blog_attach_per_entry` int(10) NOT NULL default '0', `g_blog_do_html` tinyint(1) NOT NULL default '0', `g_blog_do_commenthtml` tinyint(1) NOT NULL default '0', `g_blog_allowpoll` tinyint(1) NOT NULL default '0', `g_blog_allowprivate` tinyint(1) NOT NULL default '0', `g_blog_allowprivclub` tinyint(1) NOT NULL default '0', `g_blog_alloweditors` tinyint(1) NOT NULL default '0', `g_blog_allowskinchoose` tinyint(1) NOT NULL default '0', `g_blog_preventpublish` tinyint(1) NOT NULL default '0', PRIMARY KEY (`g_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; -- -- Table structure for table `ibf_members` -- CREATE TABLE `ibf_members` ( `id` mediumint( NOT NULL default '0', `name` varchar(255) NOT NULL default '', `mgroup` smallint(3) NOT NULL default '0', `email` varchar(150) NOT NULL default '', `joined` int(10) NOT NULL default '0', `ip_address` varchar(16) NOT NULL default '', `posts` mediumint(7) default '0', `title` varchar(64) default NULL, `allow_admin_mails` tinyint(1) default NULL, `time_offset` varchar(10) default NULL, `hide_email` varchar( default NULL, `email_pm` tinyint(1) default '1', `email_full` tinyint(1) default NULL, `skin` smallint(5) default NULL, `warn_level` int(10) default NULL, `warn_lastwarn` int(10) NOT NULL default '0', `language` varchar(32) default NULL, `last_post` int(10) default NULL, `restrict_post` varchar(100) NOT NULL default '0', `view_sigs` tinyint(1) default '1', `view_img` tinyint(1) default '1', `view_avs` tinyint(1) default '1', `view_pop` tinyint(1) default '1', `bday_day` int(2) default NULL, `bday_month` int(2) default NULL, `bday_year` int(4) default NULL, `new_msg` tinyint(2) default '0', `msg_total` smallint(5) default '0', `show_popup` tinyint(1) default '0', `misc` varchar(128) default NULL, `last_visit` int(10) default '0', `last_activity` int(10) default '0', `dst_in_use` tinyint(1) default '0', `view_prefs` varchar(64) default '-1&-1', `coppa_user` tinyint(1) default '0', `mod_posts` varchar(100) NOT NULL default '0', `auto_track` varchar(50) default '0', `temp_ban` varchar(100) default '0', `sub_end` int(10) NOT NULL default '0', `login_anonymous` char(3) NOT NULL default '0&0', `ignored_users` text NOT NULL, `mgroup_others` varchar(255) NOT NULL default '', `org_perm_id` varchar(255) NOT NULL default '', `member_login_key` varchar(32) NOT NULL default '', `member_login_key_expire` int(10) NOT NULL default '0', `subs_pkg_chosen` smallint(3) NOT NULL default '0', `has_blog` tinyint(1) NOT NULL default '0', `has_gallery` tinyint(1) NOT NULL default '0', `members_markers` text NOT NULL, `members_editor_choice` char(3) NOT NULL default 'std', `members_auto_dst` tinyint(1) NOT NULL default '1', `members_display_name` varchar(255) NOT NULL default '', `members_created_remote` tinyint(1) NOT NULL default '0', `members_cache` mediumtext, `members_disable_pm` int(1) NOT NULL default '0', `members_l_display_name` varchar(255) NOT NULL default '0', `members_l_username` varchar(255) NOT NULL default '0', `failed_logins` text, `failed_login_count` smallint(3) NOT NULL default '0', `members_profile_views` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`id`), KEY `members_l_display_name` (`members_l_display_name`), KEY `members_l_username` (`members_l_username`), KEY `mgroup` (`mgroup`), KEY `bday_day` (`bday_day`), KEY `bday_month` (`bday_month`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  5. Hey, thanks for the reply, Sadly that didn't work the current selected option is the first one for each member. Any more help is appreciated. Chris.
  6. 'lo all, I come seeking help! lol I've been racking my brain and tried many codes to get this to work and can't seem to get close to how I want it. I am using the tables from Invision Power Board and made a drop down box with the list of user groups, but only limited it to show three of the groups instead of them all. The users are in different groups. I have a list of all my users and next to it is that drop down box listing the groups, now what I want is to have the correct group selected for that user, but I can't seem to manage that, so any help would be appreciated. Here's the code: <select name="brand"> '); // query $group_query = mysql_query("SELECT * FROM ibf_groups WHERE g_id = 3 OR g_id = 6 OR g_id = 7"); // fetch data while($groups = mysql_fetch_array($group_query)) { $_POST['mgroup'] == $groups['g_id'] ? $selected = 'selected' : $selected = ''; echo(' <option value="'.$groups['g_id'].'" '.$selected.'>'.$groups['g_title'].'</option> '); } echo(' </select> This is a snippet of the code. I thought adding the group ID to a hidden field could work, that's why theirs a $_POST var in that code. So hope I made sense and look forward to hearing from you. Chris.
  7. Hello all. I am trying to make a DIV stretch to the bottom of the page on a site I am doing for a friend. I have actually managed to do it, it looks good, but the problem is that the page scrolls down a lot, when theirs nothing their to scroll down for. Here is the website. As you can see, some unwanted scrolling occurs, which I would like rid of. Here is the code I have so far: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Red Alert Fire</title> <style type="text/css"> <!-- html, body { height: 100%; } #wrapper { width: 750px; margin-left: auto; margin-right: auto; } #header { background: url(header.gif); height: 200px; } .border-l, .border-r { background: url(border.gif) left repeat-y; position: absolute; height: 100%; width: 750px; } .border-r { background: url(border.gif) right repeat-y; } --> </style> </head> <body> <div id="wrapper"> <div id="header"> </div> <div class="border-l"> <div class="border-r"> </div> </div> </div> </body> </html> If anybody would be kind enough to have a look through it and maybe guide me in the right direction, I would be most grateful. Thanks for your time, Chris.
  8. Odd as this may sound, I have only just discovered the [b]strtotime()[/b] function. I like the looks of what it is capable of and have tried to use it to my advantage. I tried to make a little script that would convert a UNIX time stamp into a message saying whether or not the stamp was a time for today, or yesterday, or if neither, then just display the date it is. I'm not a PHP pro, but am always learning. I have looked all over for tutorials on how to do this, but the only useful one's I found are for blogging software. I was hoping someone here could guide me in the right direction of where to begin coding this script, or maybe provide me with a sample that I can toy around with myself. Any help at all would be appreciated. Thanks for reading, Chris.
  9. Hello, I am stuck, as I am in the need for a very simple way to validate e-mail address' when a form has been submitted. My form is using AJAX to submit the form, and when a field is missed out, an alert() appears with the error. Here is my code for reference: [code]function sendAppForm() { // Error checking // Display Name if(document.app_form.display_name.value == "") { alert("Please choose a superstar!"); document.app_form.display_name.focus(); return; } if(document.app_form.display_name.value.length < 3 || document.app_form.display_name.value.length > 32) { alert("Your selected superstar has a too short or long name"); document.app_form.display_name.focus(); return; } // Username if(document.app_form.username.value == "") { alert("Please choose a username"); document.app_form.username.focus(); return; } if(document.app_form.username.value.length < 3 || document.app_form.username.value.length > 32) { alert("Your selected username has a too short or long name"); document.app_form.username.focus(); return; } // Password if(document.app_form.password.value == "") { alert("Please choose a password"); document.app_form.password.focus(); return; } if(document.app_form.password.value.length < 3 || document.app_form.password.value.length > 32) { alert("Your selected password has a too short or long name"); document.app_form.password.focus(); return; } // E-Mail // Role Play if(document.app_form.roleplay.value == "") { alert("You MUST provide a Role Play!"); return; } ajax.open('POST', 'ajax/send_app.php'); ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); ajax.onreadystatechange = function() { if(ajax.readyState == 4 && ajax.status == 200) { document.getElementById("appForm").innerHTML = ajax.responseText; } }; ajax.send('superstar='+document.app_form.display_name.value); }[/code] I've tried a few bits of code, and they do actually validate the e-mail when it's not inserted correctly, but when it is and I try to submit the form, well it just won't submit. Any help would be greatly appreciated! Thanks! Chris.
  10. Awesome, thanks for the quick response. I knew it was a simple code. Shame I can't see to make it work, but that's because I'm testing on my Localhost, so when I try it, it just comes up with "Page cannot be displayed" Ah well, I guess I'll have to wait until I have my web host set up. Thanks again.
  11. Hey, I was hoping you could help me; I am on the search for a bit of code that can tell me if another website on the internet is up and active, or non existent. I know it exists, as I've seen it before, but I can't find anything and I can't find the right keywords to use when searching for it. If anybody knows of such a code, could you direct it to me please? Thanks so much, Chris.
  12. Thank you guys for your code example's, they are really helpful! Could I direct you to this code which is modified to what sasa provided for me. [code]<?php $usernames = array("chris", "bob", "pete"); $passwords = array("piss", "knob", "feet"); $login = "The supplied username and/or password we're incorrect."; for($x = 0; $x < count($usernames); $x++) { if(@$username == $usernames[$x] && $password == $passwords[$x]): $query = mysql_query("SELECT id, name FROM $dbname.app_roster ORDER BY name ASC") or die(mysql_error()); while($row = mysql_fetch_array($query)) { $login =  $row['name'].'<br />'; } endif; } echo $login; ?>[/code] Notice how I am using a [b]mysql_query()[/b] to grab some data from the datasbase? Here is my situation: When correctly logged in, the big list of name's will show up, but underneath the list of name's, it will also say [i]The supplied username and/or password we're incorrect.[/i] which is the error message if a login is incorrect, yet still displays underneath the SQL results. I've tried all sort's of way's to try and solve this but have got nowhere. Hopefully somebody can solve my problem and I hope I am not becoming too much of a fuss, I just want to learn and this is a great place to do it! Thank you again for taking the time to help. Chris.
  13. Nice bit of code their and yes it does work... kind of. I have made this code my own, like so: [code]<?php $usernames = array("chris", "bob", "pete"); $passwords = array("piss", "knob", "feet"); for($x = 0; $x < count($usernames); $x++) { if(@$username == $usernames[$x] && $password == $passwords[$x]): echo("logged in"); else: echo("not logged in"); endif; } ?>[/code] Now when I try to login with say, pete > feet. It comes up like so: [i]not loggedinnot logged innot logged in[/i] which means it didn't work, and it also says that when I put the wrong details in. Do you have any advice on this? Thanks for taking the time to help me out, I really appreciate it.
  14. Hello, I have come here to hopefully seek an answer to a question I have about PHP arrays. First off, I have been an on and off PHP/MySQL developer for 5 years now, but have always worked on my own projects. One thing I never got into was arrays, at first they looked a bit scary and it puts me off wanting to learn it (sounds wussy, I know) I also have books with chapters on arrays, and they do make a bit more sense to me now, but I cannot find a use for them. Currently I am working on a small login script, I don't want to go too overboard because this isn't a big project, so I am doing it the easy way, which is this: [code]<?php else: // if login is pressed $username = $_POST['username']; $password = $_POST['password']; if($username == "chris" && $password == "meh"): echo("logged in"); else: echo("not logged in"); endif; ?>[/code] I am guessing that you could do this using arrays right, but I wouldn't know where to begin. I am hoping that I can get some advice on how to use arrays to store usernames and passwords and use them when checking for a login. I am not even sure if this can be done, but I bet it can. I am asking for this help to expand my knowledge on my favourite language to use. I have checked countless tutorial websites but I never see what I am seeking, so I can't wait to here you're answers (if I get any) Thanks for your time. Chris.
  15. Dammit, I knew it would be something really simple, something that I missed o_0 that's always the case! Thanks for pointing it out!
  16. Hello, I have found a new way to produce errors when submitting a form, ya know so if something isn't filled in, it will produce an error. Here is my code: [code]<?php // error checking if($_POST['submit']): if(!$_POST['username']) $error[] = "A username was not entered"; // No username was entered if(!$_POST['password'] || !$_POST['cpassword']) $error[] = "Please enter a password"; // No password was entered if(strlen($_POST['password']) < 6 || strlen($_POST['cpassword']) < 6) $error[] = "Youre passwords do not match"; // Passwords less than 6 characters if($_POST['password'] != $_POST['cpassword']) $error[] = "The passwords do not match"; // Passwords do not match if(!$_POST['email'] || !$_POST['cemail']) $error[] = "An e-mail was not entered"; // No e-mail was entered if(!checkmail($_POST['email']) || !checkmail($_POST['cemail'])) $error[] = "Youre e-mail address is an invalid format"; // E-Mail address is invalid if($_POST['email'] != $_POST['cemail']) $error[] = "Youre e-mail address do not match"; // E-Mail address' do not match if(!$_POST['roleplay']) $error[] = "You did not provide a sample role play"; // No role play entered if($error) { // if an error is found $msg = "<p>The following error\'s occured:<br />\n"; $msg .= "<ul>\n" foreach($error as $value) { $msg .= "<li>$value</li>\n"; } $msg .= "</ul></p>\n"; } endif; echo $msg; ?>[/code] Now when I try to run the code, I get this error: [quote]Parse error: parse error in c:\server\www\join\application.php on line 86[/quote] Line 86 been: [b]foreach($error as $value) {[/b] What's odd is I have tried this on my localhost on a different page and that work's perfectly, but yet this code, which the only difference is that I have a few more $error[] variables and instead of [i]if(!$error) { echo("bleh"); } else {[/i] I just have [i]if($error) {[/i] which I doubt should make a big difference right? Any help given will be greatly appreciated. Thank you for you're time. Chris.
  17. So I am assuming that you mean it should be like this: [code]if($_POST['change']) {   mysql_query("UPDATE `ibf_members` SET `points` = '".$_POST['amount']."' WHERE `members_display_name` = '".$_POST['mdn']."'"); }[/code] --- I tried this and it still doesn't update, the search results still disappear and the table does not update to the changed value :( I can't think where I'm going wrong, so I still hope I can get some more help. Thanks for the advice so far.
  18. Hello, I have spent the last few hours building and trying to make it so this code updates my result in the database. For some reason it will not Update and I really cannot figure it out ??? and I have come here to gain some expert help, and really hope you can help me out with my problem. This is my PHP code (it's not long) [code]<?php /* USER POINTS */ if($do == "interactive_rankings_user_points"): ?> <table width="100%" border="1" cellspacing="0" cellpadding="0">   <tr>     <td class="header">Search for Member</td>   </tr>   <tr>     <td class="row1"> <table width="100%" border="1" cellspacing="0" cellpadding="0">   <tr> <td class="row2"> <form action="" method="post"> <input name="name" type="text" style="width: 75%" /> <input name="search" type="submit" value="Search" /> </form> </td>   </tr> </table> </td>   </tr> </table> <br /> <?php if($_POST['search']) { if($_POST['change']) {   mysql_query("UPDATE `ibf_members` SET `points` = '".$_POST['amount']."' WHERE `members_display_name` = ".$_POST['mdn'].""); } if(empty($_POST['name'])) {   echo('<div class="error">The text field was left empty</div>'); } else { $query = mysql_query("SELECT * FROM ibf_members WHERE members_display_name LIKE '%".$_POST['name']."%'"); $count = mysql_num_rows($query); ?> <table width="100%" border="1" cellspacing="0" cellpadding="0">   <tr>     <td class="header">Search Results - <?=$count?> results found</td>   </tr>   <tr>     <td class="row1"> <table width="100%" border="1" cellspacing="0" cellpadding="0"> <?php while($row = mysql_fetch_array($query)) { ?>   <form action="" method="post">   <tr>     <td class="row2" width="75%"><?=$row['members_display_name']?></td> <td class="row2" width="25%"> <input type="hidden" name="mdn" value="<?=$row['members_display_name']?>" /> <input type="button" value="+" onclick="javascript:this.form.amount.value++;" /> <input name="amount" type="text" style="text-align: center" value="<?=$row['points']?>" size="4" maxlength="4" /> <input type="button" value="-" onclick="javascript:this.form.amount.value--;" /> <input name="change" type="submit" value="Change" /> </td>   </tr>   </form> <?php } ?>     </table> </td>   </tr> </table> <?php } } /* END USER POINTS */ endif; ?>[/code] I also have a picture of what it produces seeing as my localhost doesn't allow access outside of my computer [img]http://img312.imageshack.us/img312/4999/pictf1.jpg[/img] The top box is a search form and the bottom form is two results after a search. Next to each result is a input with the amount of points the user has and that is grabbed via the database. On either side of it is a button to increase and decrease the value and a submit button to be able to change it to the value you put it as. When clicked Change, the search results disapeer and it doesn't update the database, so from the code provided, can anybody tell me why? Thank you very much, I look forward to hearing from your replies. Chris.
  19. Thank you very much, that is just what I wanted :)
  20. Hello, I have a question about PHP and I hope I can get some help. I have a simple bit of code that lists the members on my forum. [code]<?php include("include/dbconnect.php"); $query = mysql_query("SELECT * FROM ibf_members") or die(mysql_error()); while($row = mysql_fetch_array($query)) {   echo $row['members_display_name'] .'<br />'; } ?>[/code] I am building a ranking page on my site, where they will be listed in order of most points (I have a points hack) and I wanted to list each of them with a number next to it, but not to use their ID because I want to list it from 1-10. [code]<?php for($count = 1; $count <= 10; $count++) {   echo $count .'<br />'; } ?>[/code] I know this bit of code creates a 1-10 list and I was trying to use it in the other code I provided to list each DB query as a number. I hope I make sense, I'm not great at talking about coding. Thanks for your time. Chris
  21. Cheers bud. Believe it or not, I actually figured it out after I posted this, lol, but I did it pretty much the way you suggested. Thanks again. Chris.
  22. First, I'd like to show my code: [code] <form action="" method="post">     <table width="100%" cellspacing="0" cellpadding="0">       <tr>         <td width="30%" align="center" class="header">Team Name</td>         <td width="40%" align="center" class="header">Members</td>         <td width="20$" align="center" class="header">Accept</td>         <td width="10%" align="center" class="header">Delete</td>       </tr>       <?php $query = mysql_query("SELECT * FROM $dbname.request_stable");       while($row = mysql_fetch_array($query)) {         if($_GET['accept'] == "true") {           mysql_query("UPDATE $dbname.request_stable SET accepted = 'yes' WHERE id = ".$_POST['id']."");         }       ?>       <tr>         <td class="row2"><?=$row['group_name']?></td>         <td class="row2"><strong><?=$row['leader']?></strong><br /><?=$row['members']?></td>         <td align="center" class="row2"><input type="hidden" name="id" value="<?=$row['id']?>" />         <?php if($row['accepted'] == "no") { ?>Not Appepted<br />                 [ <a href="?do=interactive_requests_stable&accept=true">Accept</a> ]         <?php } else { ?>Accepted<?php } ?>         </td>         <td align="center" class="row2"><input type="checkbox" name="delete[]" value="<?=$row['id']?>" /></td>       </tr>       <?php } ?>     </table>     <div align="right">         <input type="submit" name="delete_stable" value="Delete Selected" class="button" /></div>     </form>[/code] That produces a table that grabs some details from the DB. In the DB, their is a table called 'accepted' and can have the value of 'yes' or 'no'. When set to 'no', it says [b]Not Accepted [ Accept ][/b] and when set to 'yes' it says [b]Accepted[/b]. I want it so when you click [b][ Accept ][/b], it updates the DB status to 'yes' from 'no'. I thought putting a hidden input with the row id as the value, then using $_POST['id'] in the mysql query might get it to set the selected row to update, but nothing happens when I click it. Hope I make sense, I never seem to think I do when I ask for help here. Thanks for taking the time to look and I hope to hear from you soon. Chris.
  23. Hey, sorry to bump this, but I really can't figure it out, even with the example code, am just getting errors. It's probably gonna be something really simple, and i'll end up kicking myself for it, lol, usually the case.
×
×
  • 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.