Jump to content

EchoFool

Members
  • Posts

    1,074
  • Joined

  • Last visited

Everything posted by EchoFool

  1. I already have this idea but before the for loop begins i got: <div class=tablecenter> <table width="500" border="1" cellspacing="0" cellpadding="0" align="center"> <tr> <td width="200" align="center" class="blackBold">Item Name</td> <td width="200" align="center" class="blackBold">Quantity To Send</td> <td width="200" align="center" class="blackBold">Remove Amount</td> <td width="200" align="center" class="blackBold">Remove Quantity</td> </tr> <?php foreach ($_POST['Checkbox'] as $Value => $ItemID){ if i was to get an error in the for loop it would error and show the table above which doesn't look too neat this is why i needed to seperate.
  2. I have a array which i want to validate now i tried my initial idea but realised there was a slight flaw with it as it will still load the table even if the array is in valid which looks a bit unprofessional with a blank table with error written next to it. So i need a way "before" the for loop on the array to check the array for validation then run the for loop.... foreach ($_POST['Checkbox'] as $Value => $ItemID){ This is the for loop, but before the loop begins i need to do another for loop before it to check the array values are numerical and not blank, and a query is needed to check against the database that the values match the user's account.. i can make the query and validation no problem, but how can i for loop to check this before doing the next for loop which involves the table...won't the position of the array be at the end rather than the beginning when i start the second for loop on the array?
  3. I'm using the checkbox as part of the array selection as below: <input type="text" size="16" name="Quantity[<?=$Count?>]" value=""></td> <input type="checkbox" name="Checkbox[<?=$Count?>]" value="<?=$ItemID?>"> Barand helped me with this part a while back. Which works, just need to find a way to make the error output only show once so it looks more professional in the for loop.
  4. I need help with a for loop using validation.. I have a check on the forloop to make sure all inputs match the requirements but if they are not i want it to show an error which i can do but if there was like 8 inputs then itll end up showing: x8 So was wondering is there a way to cancel the forloop when the error occurs and show only "one error". I can't be using header re-directs, become my main global include contains the title and headers...so output has already started. <?php include("include.php"); foreach ($_POST['Checkbox'] as $Value => $ItemID){ $Quantity = mysql_real_escape_string($_POST['Quantity'][$Value]); If($Value == '' OR $Quantity == '' OR !(is_numeric($Quantity)) OR !(is_numeric($Value))){ ?> <p align="center"><br><br> <span class="NegativeMoney">There was an error!</span><br><br><br> <a href="myitems.php?choice">Back</a></p><br><br><br><br> <?php } } This is what i got, hope you can understand what i am on about
  5. Oh i see so the $Count for both of them would then equal the same value which is how they are linked? I think i understand now Thanks Barand. SOLVED
  6. So do i even need to have the names : Checkbox[<?=$Array?>] Quantity[<?=$Array?>] For the 2 input boxes still then ?
  7. I know but i want to block people sending stuff across accounts that have the same IP's
  8. I have a question about user's who have dynamic IPs.....i hear that over time they stop being assigned to a certain IP range of X amount of time, and so I though it might be not be logical to permanently store all their IP's and should remove certain IP's if they have not been used over a certain amount of time from the logs table..... Does any one know if this information that I have been told is true? I don't know how dynamic IP works exactly. And also wondered if you know "how long" I should wait till i remove an IP that a user is assigned to, if this were true... Hope you can help.
  9. I am having difficulty understanding arrays. I read through page about them but didn't explain how to get it working via a form with checkboxes and inputboxes to set the array... <input type="text" size="16" name="Quantity[<?=$Array?>]" value=""> <input type="checkbox" name="Checkbox[<?=$Array?>]" value="<?=$ItemID?> I have this in a while loop that loads a list of items, and what it does is, it puts the itemID in the checkbox...so the selected checkboxes will have a list of ItemID's. Then with that it is meant to grab the quantity from the Quantity input box adjacent to it.. so the array would end up forming like this: Id | Quantity 2 | 34 5 | 2 6 | 23 I think i got it right with the above two lines but I don't know how to call it up on a processing page to use the data from the array
  10. You can. Use NULL if you wanr it to auto_inc (or omit it completely) but it will accept a value so long as that value doen't already exist. Yeh but with my guess is the auto-increment is also primary key... so im going to guess that to insert a value would be pretty difficult to find a unique without a pre-check everytime. But again as said in the other post we dont know what the field is! >.<
  11. To be fair though juding by the email of this guy on his/her profile im going to assume the person is under the age of 10 ... so lets not jump at his/her throat too much just yet
  12. mysql_connect("localhost", "root", "com12345") I hope that aint your real password? Your insert query doesn't say what fields to INSERT to for the values either
  13. Where can i find a SMTP for free to generally test it out on my pc? I don't want to be loading files to any where except from my hard drive... so am hoping they have a local host one and not one that is on a real online server ?
  14. I am trying to get a email script working on my registry page, but it will not work... I keep getting an error when i send i make it send.... : Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() Not sure how other people have managed to get it to work on localhost so was hoping some one here might know how?
  15. Can't use time cos if you edit a post "after" some one replies.. then the new edited version time stampe will be newer than the other guy's post. I use a ID but how would you pull out the specific .. thats the tough part.
  16. Thats what i was planning to do... but then how would i with that table and the other table list all posts in logical order if a staff wanted to see the user's posts for any illegal activity .. thats the problem
  17. I need some input on how you would approach this idea logically using tables too.. I have a forum... where by users can edit their posts. But i want to store the original version.. then the new version as a separate row. But obviously then i would have post ID clashes as i sort the post's output by ID order. So i need to some how store the edits with the original so staff can see what they are trying to hide if anything, whilst the post remaining in its exact same position as it did originally in terms of the order of the posts in a thread... How would you go about this.. (i don't need code help here) just logic, is the problem. Once i know the logic i will be able to do it.
  18. Yeh but then i loose the format of the input... say the input was : test test Test and i removed it.. it comes out like test test test
  19. I have a problem with my script. I input data using a function to maintain its line structure... This part works fine... $QuoteMessage = nl2br($row['Message']); $UPDATE2 = mysql_query("INSERT INTO posts (ThreadID,UserID,Message,CreatedOn) VALUES ('$Thread','{$_SESSION['Current_User']}','$Post','$Date')") Or die(mysql_error()); How ever if i want to echo it with my function involved i get this: Test<br /> test<br /> <br /> <br /> <br /> Test<br /> Test<br /> e<br /> <br /> tete<br /> w000 This is how it should look As you can see its not doing the lines but its echo'in the actual layout html code. This is what i have for my output: <?php function BBCode($BB){ $BBCode = array("&" => "&", "<" => "<", ">" => ">", "[b]" => "<b>", "[/b]" => "</b>", "[i]" => "<i>", "[/i]" => "</i>", "[u]" => "<u>", "[/u]" => "</u>", "[Quote]" => "<div class='quotetop'>QUOTE</div><div class='quotemain'>", "[quote]" => "<div class='quotetop'>QUOTE</div><div class='quotemain'>", "[quote]" => "<div class='quotetop'>QUOTE</div><div class='quotemain'>", "[/Quote]" => "</div><br>", "[/quote]" => "</div><br>", "[/quote]" => "</div><br>", "[sQ]" => "<div class='quotetop'>QUOTE <span class=PositiveMoney> ", "[sQ2]" => "</span></div><div class='quotemain'>", "<br />" => "",); $Message = str_replace(array_keys($BBCode), array_values($BBCode), $BB); return $Message; } //query get message stuff here //------------------------ $newString = BBCode($Message); $newString = str_replace('<br />', '', $newString); echo $newString;?> What did i do wrong?
  20. So do i do that when i get the value from the form like: $Message = mysql_real_escape_string(nl2br($_POST['Messagge'])); And then also on echo'n do the same thing?
  21. I have a problem with my textarea processing. Say a user creates a list in the text area to post in the forum.. like this: 1) test 2) test 3) test when it is echo'd out in the forums it comes out like: 1) test 2) test 3) test which is not the correct format... how do i maintain the layout structure of the user's input when php is submitting it to the database?
  22. Good spot! Thanks everyone SOLVED
  23. Well i made life slightly easier for myself using a BB function so now i put: $QuoteLine = '[quote]'.$QuoteUsername.'<br>'.$QuoteMessage.'[/quote]''; But it's not liking that either.. do i have to escape / symbol on the ?
  24. I have a syntax error on a string im building using variables.. not sure how its meant to be done properly... this is the line: <?php $QuoteLine = '<div class='quotetop'>QUOTE</div><div class='quotemain'>'.$QuoteUsername.'<br>'.$QuoteMessage.'</div>'; ?> Parse error: syntax error, unexpected T_STRING on line 486 How is it meant to be ? Hope you can help
×
×
  • 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.