Jump to content

CMellor

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Everything posted by CMellor

  1. Is any of the code you provided their a bit wrong, 'cause it looks a bit wrong, mostly just the implode() function, I'm getting Bad Argument errors when doing it with the code above. Do I add the implode() function inbetween the foreach() function? like so... [code]<?php foreach($_POST['stable_mate'] as $members) { /* INSERT IT IN HERE ??? */ mysql_query("INSERT INTO $dbname.request_stable(leader, members, group_name) VALUES('".$_SESSION['name']."', '$members', '".$_POST['team_name']."')"); echo('- ' . $members . '<br />'); } ?>[/code] Sorry, just don't seem to understand it, maybe I need to take a break, lol. Thanks for your help though, I really appriciate it.
  2. Follwing on from this... I want to add the values of the inputs into the database, but when I execute it, it add's each input value as a row, and doesn't list them in the same row. Here's the code: [code]<?php } } elseif($_POST['submit_stable']) { ?> <tr> <td class="preres" style="background: #CCC"> <p>Thanks. Your chosen stable name is <strong><?=$_POST['team_name']?></strong>.</p> <p>And you have chosen:</p> <?php foreach($_POST['stable_mate'] as $members) { mysql_query("INSERT INTO $dbname.request_stable(leader, members, group_name) VALUES('".$_SESSION['name']."', '$members', '".$_POST['team_name']."')"); echo('- ' . $members . '<br />'); } ?> <br />to be in your stable. </td> </tr> <?php } else { ?>[/code] I thought it would of listed the values in the same row, but no, it lists each value as a row. Can anyone tell me what I might be doing wrong? Thanks.
  3. Hi. If I could just draw your attention to this snippet of code: [code]<tr> <td class="preres" style="background: #CCC"> <fieldset><legend>Who's in your stable?</legend> <form action="" method="post"> Select a name for your stable.<br /> <input type="text" name="team_name" /><br /> Your selections must be on the same brand show as you.<br /> <?php for($i = 0; $i < $_POST['number']; $i++) { echo('<input type="text" name="stable_mate[$i]" /><br />'); } ?> <input type="submit" name="submit_stable" value="Request"/> </form> </fieldset> </td> </tr> <?php } } elseif($_POST['submit_stable']) { ?> <tr> <td class="preres" style="background: #CCC"><span class="tag_error"><?=$_POST['stable_mate']?></span></td> </tr>[/code] Before this part of the code works, you select a number between 3 and 5 and depending on the number chosen, that's how many input boxes are displayed. I used the for() function to do that. To do this though, I did find it from a PHP book I own, that's why in the input's name, it says [$i] after the name. What I can't figure out is how to display the text I input on the x input boxes, so if I selected 3 input boxes, filled them in, and clicked Submit, I'd want it to display those 3 input values. If anyone knows how I can do this, I'd be grateful. Thanks for your time. I look forward to your responces. Chris.
  4. Thanks for the help but that didn't do anything. Here's what I have. [code]<?php /* TAGS */ if($do == "interactive_tag_board_tags"):   $query = mysql_query("SELECT * FROM $dbname.tags ORDER BY id DESC");     if(isset($_GET['delete'])) {       mysql_query("DELETE FROM $dbnames.tags WHERE id = '".$_GET['delete']."'");     } ?> <table width="100%" cellspacing="0" cellpadding="0">   <tr>     <td class="header">Tags</td>   </tr>   <tr>     <td class="row1">     <table width="99%" cellspacing="0" cellpadding="0">       <tr>         <td width="5%" align="center" class="header">ID</td>         <td width="25%" align="center" class="header">Poster</td>         <td width="55%" align="center" class="header">Tag</td>         <td width="15%" align="center" class="header">Options</td>       </tr>       <?php while($row = mysql_fetch_array($query)) { ?>       <tr>         <td align="center" class="row2"><?=$row['id']?></td>         <td align="center" class="row2"><?=$row['poster']?></td>         <td class="row2"><?=$row['tag']?></td>         <td align="center" class="row2"><input type="hidden" name="id" value="<?=$row['id']?>" />           <a href="?do=interactive_tag_board_tags&delete=<?=$row['id']?>"><img src="../img/delete.gif" /></a></td>       </tr>       <?php } ?>     </table>     </td>   </tr> </table> <?php /* END TAGS */ endif; ?>[/code] Nothing happens when I click delete.
  5. The actual code I posted isn't the problem, though thanks for pointing that error out. I just asked if someone could write a little bit of code to allow me to delete my selected tag. I know it's asking a bit, but I know it can be done with only a couple of line's of code. I did try this, but it said "delete" before I even did anything [code]if($_GET['delete'] == $row['id']) {   $refresh = mysql_query("DELETE FROM $dbname.tags WHERE id = '".$row['id']."'");     if($refresh) { echo('deleted'); }   }[/code]
  6. Hey. I've made a tag board, and an ACP to delete/ban posts/users, but I can't for some reason get to be able to delete the selected posts when I click delete on the tag. Here's my code, it aint long. [code]<?php /* TAGS */ if($do = "interactive_tag_board_tags"): ?> <table width="100%" cellspacing="0" cellpadding="0">   <tr>     <td class="header">Tags</td>   </tr>   <tr>     <td class="row1">     <table width="99%" cellspacing="0" cellpadding="0">       <tr>         <td width="5%" align="center" class="header">ID</td>         <td width="25%" align="center" class="header">Poster</td>         <td width="55%" align="center" class="header">Tag</td>         <td width="15%" align="center" class="header">Options</td>       </tr>       <?php $query = mysql_query("SELECT * FROM $dbname.tags ORDER BY id DESC");       while($row = mysql_fetch_array($query)) { ?>       <tr>         <td align="center" class="row2"><?=$row['id']?></td>         <td align="center" class="row2"><?=$row['poster']?></td>         <td class="row2"><?=$row['tag']?></td>         <td align="center" class="row2"><input type="hidden" name="id" value="<?=$row['id']?>" />           <a href="?do=interactive_tag_board_tags&delete=<?=$row['id']?>"><img src="../img/delete.gif" /></a></td>       </tr>       <?php } ?>     </table>     </td>   </tr> </table> <?php /* END TAGS */ endif; ?>[/code] Can anyone give me a quick code that let's me delete the tag I select? I put a hidden input in their, thinking maybe that could be used somehow. Would really appriciate the help, thanks a lot. Chris.
  7. Thanks for your help guys. From the stuff you told me and the links you provided, I came up with this: [code]<?php $string = "qwertyuiopasdfghjklzxcvbnm0123456789"; echo str_shuffle(substr($string, 0, 32)); ?>[/code] It's small, but does the job. Simple.
  8. [!--quoteo(post=359033:date=Mar 27 2006, 09:09 PM:name=toplay)--][div class=\'quotetop\']QUOTE(toplay @ Mar 27 2006, 09:09 PM) [snapback]359033[/snapback][/div][div class=\'quotemain\'][!--quotec--] See second line code example at: [a href=\"http://us3.php.net/manual/en/function.uniqid.php\" target=\"_blank\"]http://us3.php.net/manual/en/function.uniqid.php[/a] [/quote] Cool, thanks. Is their a way to change the limit as to what I random, like that function provides 32 characters, but what about, say for example, I wanted it to just provide a random 5 character string? Thanks.
  9. Hey, Does anybody know a simple script to randomize a string of random letters and numbers, like so: [b]$string = "abcdefghijklmnopqrstuvwxyz0123456789";[/b]. I thought [b]rand()[/b] would've done the job, but that only works with numbers and then I tried [b]str_shuffle()[/b] but that only randomizes the full string, and I want to limit my string to 32 characters (well any really, but i'm using 32 for what I need). If anyone can help, that'd be great, thanks. Chris.
×
×
  • 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.