Jump to content

wolfcry

Members
  • Posts

    106
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

wolfcry's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks for the answers all. I figured as much lol. @mac_gyver: I would but in the end I would still have to redirect or reload which is what I was trying to stay away from.
  2. Anybody out there? lol
  3. This can only be done with JS/Ajax correct?
  4. Sorry Jessica, I was trying to get multiple things done at once and completely spaced it. My apologies. Here is the tidbit of code. Obviously there's more before and after but none of that pertains to this portion. { echo '<table><tr><td>'; for($i=1; $i<=$Sets; $i++){ $Calcs = CalcType($SpecId, $min, $CQuantity, $CType); echo 'Calculations for '.$SetText[$i]; foreach ($Calcs as $key => $DisplayCalcs) { $SetCalcs[] = $DisplayCalcs; echo $DisplayCalcs.', '; } if($Sets == 1){ $SetResults = implode(',',$Calcs); DB_Insert($EData,$Total,$Modified,$Counter,$Sets,$SetResults,$TimeStamp); }else if($Sets >= 2){ echo '</td><td> => <input type="button" name="SelectThis" value="Keep This Set"></td><tr><td>'; } } echo '</td></tr></table>'; if(isset($_POST['SelectThis'])){ DB_Insert($EData,$Total,$Modified,$Counter,$Sets,$SetResults,$TimeStamp); } } As previously stated, everything works up to the point of trying to select a specific calculation from multiple options. I'm sure I'm just spacing something and I'll most likely need an OnClick JS handler for this, which is fine, but I was really hoping I could do it strictly using PHP. I'm sure it's due to the fact that I'm not using <form> tags with the buttons and redirecting back to the page, but I was hoping there was a way to do it without needing to use them.
  5. Hello all, I'm not really sure if this should be in the SQL portion or not. I don't think so because I'm not having issues with SQL syntax, just the proper PHP (?) coding to achieve a specific result. What I'm trying to do have the user perform a randomized calculation that outputs multiple results; displaying those results on the screen and have them select the result they wish to keep. This result is then inserted into the database accordingly. To give a better example, let's say the user performs the action and the following results are displayed (I'm using names just as an example): David Josh Carrie Spike and they wish to keep "Spike". When they click on the link that states, "Save", Spike is then inserted into the database. I can get the multiple calculations to perform; have them show up on the page with the "save" link next to each one, but nothing is inserted when the link is clicked. Can PHP perform this action or will I need to use JavaScript for this?
  6. while-do That made me chuckle . It's actually called a "do-while" loop because the script will "do" something at least once and keep doing it it "while" a certain condition remains true.
  7. If you don't really care about duplicate data, store it all in one database that way it'll make querying a bit easier (not requiring JOINs etc.) A basic DB structure I've done for this sort thing was like: Table: ClanMatches Team_A | Team_B | Scheduled_Match_Name | Match_Date_Time | Winning_Team | Losing_Team | Winning_Score | Losing_Score | Then you simply query the rows and display them as you see fit. Mind you, this isn't the best method if you're looking for cardinality but it's more than enough if you're running a simple clan site.
  8. Without seeing your actual form code, are you sure this: $_POST['Item_Number']; is spelled correctly or actually exists in the form?
  9. There are a variety of ways to do it, but the easiest in my opinion is simply placing it in a secured directory and using .htaccess to deny direct access. Here is a great site on writing .htaccess permissions: http://www.askapache.com/htaccess/htaccess.html And here's an example about protecting your include file from being directly accessed if you don't want that to happen: http://davidwalsh.name/htaccess-security-include-files
  10. I've always used it and never had an issue but then again, I use it with other conditionals as well.
  11. And you should do some validation as well: if ($Item_Number) { /// } Should be: if (is_int($Item_Number)) { /// } To ensure that the $Item_number is in fact an integer if only integers is what you want. I'd also do the following with submit just for additional validation purposes: if (is_int($Item_Number)) { if (isset($submit)) { // do something } } As for your undefined index warning, define $Item_Number at the top like so: "$Item_Number = 0;". Either that, move "$Item_Number = $_POST['Item_Number'];" into the $submit if() statement.
  12. Have you tried comparing it against NULL? if ($row['fieldname'] == NULL){ do something. }
  13. Yeah, Pikachu2000 hit the nail on the head with the manual reference and you need to bookmark that site. Though, sometimes it can be confusing for those just learning PHP IMHO. If you like books, one of my favorites is Beginning PHP and MySQL and if you're more of a visual type of learner through "live video" teaching, http://thenewboston.org/tutorials.php has awesome tutorials on quite a few languages, including PHP (It's under the Computer Programming) section on that page.
  14. That's because the form is submitting back upon itself (to the same page). To accomplish this use the name of the file in the form action like so: <form action ="same_page_of_form.php" Method="POST"> When the user submits the form, it will simply submit back to same_page_of_form.php. So if your form is on index.php and you want to stay on index.php, simply use index.php in the action.
  15. Wow, I sense a bit of bitter impatience there. Considering I didn't even get the code I requested until nearly 7 hours after the fact around 8pm my time and when I'm trying to spend time with my family... Anyways, since I'm getting the gloomy feeling that our help is more expected rather than appreciated, good luck with your script, I hope you fix the issue.
×
×
  • 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.