-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
Form validation with javascript is not a good idea. People can just turn off javascript and happily go on their way sending your server whatever they want. You should only use javascript as a "feature" to help reduce requests to your server. Field left blank? use javascript to give a popup or something, before the form is sent. But check if it's blank with php just the same.
-
Okay so you told us what you're trying to do, but you didn't tell us what the problem is, and you didn't show us any code.
-
Would be helpful if you mentioned what script it is, and something more specific than "it won't install." On that note...moving to 3rd party forum.
-
Really? I've only done some minimal gallery2 poking and prodding (coincidentally, I installed it for a friend last night), and the only "external" feel I get from it is the ability to add photos to a "cart" and then get them printed by 3rd parties. All pictures are stored locally, tons of features, etc.. can you be more specific about how it feels "external?" By "external" do you mean "smaller?" as in, something to be included in a div or frame on your own site?
-
About 6 years ago my little brother was playing this browser text game where you attack other players and move up in ranks etc.. and this game had about 100k players, and I thought wow, this game isn't very complex..I could make something way better and grab those people. So I went down to the local Barnes and Noble and bought PHP In Easy Steps. It had just come out, cost me like $5, and covered the basics. After that, I referred directly to the manual.
-
well in my code, if you make $percent = 0; // 0%..no sales.. then it will return 0 on the scale. Or hell, even if you use a bit more than 0%, I do have a round wrapped around the equation, so you still might get 0 returned (for some odd reason I assumed he wanted whole numbers). I think he might wanna take out the round, because that might hurt someone's feelings if you say they are a zero when they sold something. But other than that, the equation/return is free to show .00000...1 out of 100. lol nah I was referencing his bitching about some girl nagging him at work
-
lol maybe if you didn't have people constantly distracting you at work you woulda figured it out on your own
-
Is this what you mean? <?php $maxpercent = 46; // 46% is the new 100% $percent = 23; // 23 would be 50% of 46 // scale of 1-100, 23 should be 50 // since 46 "equals" 100, we find out what it takes to make 46 turn // into 100, so divide 100 by 46. then we just take that number // and multiply it with $percent to scale it up $pos = round((100 / $maxpercent) * $percent); echo $pos; ?>
-
[SOLVED] how to insert variables into header()
.josh replied to advancedfuture's topic in PHP Coding Help
Assuming that $city and $state actually hold something.. header("Location: index.php?c=$city&st=$state"); -
look into curl
-
LOL. Seriously, what kind of major university would have real world coding like that?
-
$db->field1
-
my first guess is a page hit counter
-
ummm...i don't really see how what you've done will work. your previous $mailcontent is still being written over every single loop iteration. Did you try my code? You said that everything works fine except all you're getting is the info from the last loop. That's because your overwriting the data every single time. All I did to that code was add a dot before the = in your $mailcontent assignment, so it concats the new info onto the previous info...which is what you 1/2 did right there. You broke it up and used the dot but on the next loop iteration, your first = will just overwrite it.
-
all you're going to do is read 1 digit? And you're concerned about performance? LoL...dude even with huge files like megabytes huge, we're talking microseconds difference in time here.. I can't even imagine how small of a difference we're talking about when reading 1 little character.
-
code itself works fine. Problem is elsewhere. Sessions not being allowed, maybe cookies set not being allowed in your browser. edit: assuming that that's the entire contents of your file ^
-
well that's fine and dandy if all you're wanting to do is echo out the contents.
-
need to put session_start before trying to use session variables.
-
nope. from the manual: ("the code above" is an example of how to use fread to get the contents of a file into a string).
-
you can do a foreach loop on the array and do a strcasecmp on each needle/element, or if you look at in_array in the manual in the notes towards the bottom there's a function provided using preg_grep
-
well if you look at the manual for both file_get_contents and fread, they both say that file_get_contents is preferred because it gives much better performance. But that's if you're just wanting to get all the contents of the file. fread is more versatile. Depends on what it is you're trying to do.