Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. You need to set a value for each option and give the select tag a name: <?php if(isset($_POST['local_pickup']){//has the form been submitted? echo 'Local pickup: '.$_POST['local_pickup']; } ?> <select name="local_pickup"> <option class = "blue_standard" value="no">No</option> <option class = "blue_standard" value="yes">Yes</option> </select> Also, you don't really want to be echoing out the variable between your select tags
  2. If you are using http_referer for data collection purposes, which is not crictical to the running of your site, then that is fine. However, i would disagree with btherl that only technically minded people may be making requests without an http referer being sent. As i've said before, some filewalls (notably norton filewalls - google and you'll see) by default disable the sending of the http referer. This is the main reason why i feel that using the http referer to prevent access is a bad idea - perfectly legitimate computer illiterate users can be blocked. However, i will agree that it can be used to prevent other sites linking to your files - if the http referer is present and it is not from your website and the file being retrieved should only be accessed from a user already on your website, then it is a method of protection against the non technically minded. Incorrect. Unless you set PHP up to pass the session id around in the URL, cookies need to be enabled for sessions to work. As for the question rj2kix: im not sure what you're really trying to do? Why would you store the name of the website that a user came from in a cookie?
  3. As in, use the double quptes inside the header function: <?php $search = 'random'; $location = 'mysite.com/myfile.php?search='.$search; // mysite.com/myfile.php?search=random header("Location: $location"); ?> Strings inside single quotes are treated as literals: you are litterally trying to send the browser to $location - not the value of $location.
  4. The php manual suggests you do a SELECT COUNT(*) query to determine the number of rows.
  5. Some of my teachers do that too but it's actually a catch, They expect you to agree with them and not argue with them.. And when you agree with them they say "wrong!..." so never agree! lol even if it sounds like a stupid question they usually do it to like catch you out. No, it really wasn't a catch. The IT teachers at my school really are completely useless. Mind you, i suppose that given the content of the 'IT' GCSE here in England, you really don't need to know much about computers. About 80% of the focus is on communication, and the other 20% on basic computer literacy. For example, you could make a website, which looked great and worked well but get no marks for it. Someone else could make a rubbish website which didn't work, and could get lots of marks for it if they explained why it was rubbish, and why it looked bad.
  6. Oh so familiar. The IT department at my school is an absolute joke. It's pretty much entirely staffed by games/PE teachers who really haven't got a clue when it comes to computers. If i'd attempted to talk to my IT teacher about PHP then i would have recieved a completely blank look - HTML was too much for him. In fact, i've just remembered a little story. One IT 'lesson' we were doing something rather pointless and my teacher was making something which he claimed to be a website. His question to me: 'So, if i want to get this actually on the internet, i go to File->Save As right? ' Needless to say, i struggled to keep a straight face. Hosting and domain names were a bit of a new concept for him.
  7. I'm going to see my friend's band at the pub tonight if that counts?
  8. Take a look at the source of the generated code. Your php script is generating the correct HTML character codes; your browser is rendering them as the correct character. Edit: However, with your present code, nothing would happen anyway. To turn single quotes into &#039;, ENT_QUOTES must be set. See: www.php.net/htmlspecialchars
  9. Your code doesn't really make much sense to me. You are looping through results from whatever table is in $table13 to produce your links. Yet the number you echo is supposed to be the number of rows returned from another table($table1), so you would always end up with the same number on each category. What is your table structure? Where are you trying to get the information from?
  10. I take it you are running one of the latest versions of php5? The function has only been avaliable since 5.2.2. Also, did you see the user contributed notes at the foot of the page? (www.php.net/imagegrabwindow) It's mentioned there, and im sure i've seen it somewhere else too, that apache must have access to interact with the desktop.
  11. I would imagine that's actually to do with the ownership of land. It certainly is here. If someone owns a piece of land, they're perfectly entitled to let someone of whatever age drive around on it, regardless of licence/ability to drive etc. The law applies to people driving on public roads. As for the comment on older drivers causing more accidents - bring in retests every 5 years i say.
  12. Sorry? Im not sure what the problem is. By ordering your results by the field, you would get the the results beginning with an a first. The query, at is simplest, is just: SELECT * FROM `yourtable` ORDER BY `thefield`
  13. You can submit the form on the external site using cURL. But i dont think you will be able to re-direct to their site and have the form 'pre-filled' but not submitted. I'm not too sure why you'd want to either.
  14. Well, perhaps if you show us the code you have used so far, we might be able to point out what needs changing. Post it up inside tags(without the spaces) and we'll take a look.
  15. Well, im assuming you need to perform this multiplication on the $sum variable used here: $sum = number_format(array_sum($sum),2); In which case, this should do: $sum = number_format(array_sum($sum*1.1*1.07),2); Burtybob: There's no need to use so many variables. The multiplication doesn't need to be done separately.
  16. Where you supposed to be using a variable variable in these few lines?: while ($$category_rows = mysql_fetch_assoc($query_result)) { echo '<li>'; echo '<h4 class="job_description"><span class="job_label">'.$$category_rows['association_name'].'</span><span class="tracking_num">'.$category.'_rows["tracking_num"]</span></h4>'; echo '<ul class="job_details">'; echo '<li class="qty">'.$$category_rows['pieces_cnt'].'</li>'; I assume not, since you then use a normal variable later on - and $category_rows is undefined. Try using a single $ sign.
  17. Surely you need to be sorting by the points a user has?
  18. Yeah, you can use regular expressions: <?php $str = 'the file size {link:somefile.pdf} is really big.'; preg_match('|\{link:(.*)\}|',$str,$matches); $size = getFileSize($matches[1]); $str = str_replace($matches[0],$size,$str); echo $str; ?>
  19. Try: $query_string = "SELECT * FROM $tablename WHERE UNIX_TIMESTAMP(`ended`) < UNIX_TIMESTAMP()" The idea is that we convert our date to a unix timestamp (the number of seconds past since 1st january 1970), which we can then compare with the current timestamp. See here for what can be achieved with date and time functions in mysql.
  20. Its a simple case of having some sort of status field and using the ORDER by clause on your query. This should relate only to if a topic is pinned. You will need a different field for locking threads. The reason why it appears that we have pinned, followed by pinned and read only, followed by others is simply because those which are pinned and NOT read only, have, of course, been posted in more recently that the read only topics. The query to grab the topics would order by status(pinned or not) then by last post. Wether or not a topic is read only has nothing to do with the ordering.
  21. If you're using windows and if you're using the lastest version of PHP then see: imagegrabwindow() Its a very new function.
  22. I assume $victim is a string? You must quote strings in your query. I assume $c_userid is a number, which do not need to be quoted. Try: $killquery=mysql_query("SELECT * FROM members WHERE `displayname`='$victim'") or die(mysql_error());
  23. So you want to reduce both variables by the same amount, until dividing the debt by the value produces a particular percentage? Well, that boils down to a fomula which you can manipulate: (D-x)/(V-x) = Y Where D is our debt, V is our value, and Y is the required fraction (e.g. for 33.3..%, Y is 0.33...) D-x = Y(V-x) D-x = YV-Yx Yx-x = YV-D x(Y-1) = YV-D x=(YV-D)/(Y-1) Plug your numbers in for Y,V and D and you'll have your x.
  24. Personally i think thats a good thing. What happens with your present system if the unique number exceeds 99,999 in each year? While its probably unlikely, it would be better to design it such that you wouldn't have a problem with a larger number.
×
×
  • 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.