Jump to content

linuxdream

Members
  • Posts

    124
  • Joined

  • Last visited

    Never

Everything posted by linuxdream

  1. Not to be mean or anything (I'm just inquiring), but why is your boss having you do this when it looks like you really don't know what to do? I would think that if your boss knew that you needed help he/she would get someone to help you out. But then again, some supervisors can be be true @$$es... Might want to check out [url=http://us2.php.net/session]http://us2.php.net/session[/url] for a primer on sessions. I would think that sessions are your answer until the form is submitted for good. What 3 buttons are you talking about? What are they supposed to do? Styles will hide/display them. Other than that, aside from completing the project for you, not sure what other help you need. It's generally better (for getting more responses) if you have more specific errors or specific code/design questions.
  2. When you say parent/child objects, are the child classes extending the parent classes? From what I know, child classes should extend the parent class and thus inherit all the parent variables and methods unless set to private or something like that. For instance: [code]<?php class foo{     var $name = "Brandon";     function foo(){         echo $name;     } } class bar extends foo{     function bar(){         echo $name;     } } ?> [/code] Both classes should echo "Brandon".
  3. Maybe I am way off here (because your post was a bit confusing, and an whole lot of code...use the code brackets next time) I think you know how to get the results but just want to know how to display those results once you get them in a sort of "dynamic" way (since you report no errors, I can assume your code works)??? If that's the case, I would create hidden <div>'s with the third dropdown results then when a user clicks an option in the third menu, use JS to change the div style to "block" to magically diaplay the table. This would work for each of the third dropdown options if you dynamically create the <div>'s given your DB results. Google "hidden div javascript" to figure out how to do this. I'm probably way off on this solution, but I though I would give it a try.
  4. You should check out the PHP documentation on arrays to get a thorough understanding of arrays (http://us3.php.net/types.array). Arrays in PHP can store pretty much everything including other arrays, values, and even objects. I've used arrays up to 5 levels deep (though not by choice) and I'm sure you can go much deeper than that.
  5. The errors on the page look like you are trying to access array elements that are not there...hence the "Undefined Offset." Check the line numbers that the errors report and see if your array has the content that it should. I usually get these when I forget to error check a DB query and try to access the results array which, of course, would have nothing in them.
  6. Where are you submitting the form (as in, where is the form tag)? The hidden form element will only pass if you submit the form that contains it. Sessions might be better for you here.
  7. Yea, explode then foreach if it's a small loop (for, is more efficient than a foreach for arrays with a lot of data). [code] <?php $data = "something|nothing|again|and again"; $adata = explode('|', $data); foreach($adata as $item){     echo $item . "<br />"; } ?> [/code]
  8. Did you check the permisisons of the file like drifter said? If you uploaded and wrote the file using fwrite or something like that, it is probably owned by www-data or whatever your wed server's system user is (even if your upoad script was run by you). You would need to change either the owner/group and/or relax safe_mode to match GID and not UID. Creating and removing files through PHP is difficult to get right given the security/permission problems.
  9. The *? matches as few times as possible, otherwise called a lazy quantifier. So basically, with the " after the ? it will match everything upto the first " and stop. Without the ?, it would match all the way until the next full expression is matched, including any "'s
  10. If you don't want the user seeing the data then you should probably look into using session variables. Not sure if the data is going to be super secret but the user can simply view source to see it. Session data cannot be seen by the user so easily. But I would guess that this is not really your problem. Try your test page again and submit a single quote and clock Go. Then in the result page, view the source. You will see that the ' gets interpreted as ending the value argument. In your foreach you need to escape the submitted value like so: [code] <?php foreach ($_POST as $field => $value) { ${$field} = addslashes($value); } ?> [/code]
  11. Maybe something like preg_match_all('/href="(.*?)"/, $html, $links); Makes the  search not greedy and stops at the first " encountered after the URL. That way you have the link, then use parseurl() to breakup the URL into the pieces you wanted. Doing it the other way will match everything until the next href" in $html.
  12. Unfortunately, I've never worked with php/mysql in an IIS environment. I was just looking through the php.ini file on my own Linux box and saw reference to the session.save_path being a bit different for Windows. A quick google on the topic gave me this: http://www.ricocheting.com/server/php.html Might help. Good luck.
  13. Yes you can have arrays in a session array. You can even put objects in there. It functions just like any other array, only it's data is available to you across the site (with enabled sessions of course). What you did was correct for adding another array to the $_SESSION['price'] key. So you could do [code] <?php $_SESSION['moreprices'] = array('something', 'else', array('and', 'again')); ?> [/code]
  14. Check your logs for warning about set_time_out. If safe_mode is on, then set_time_out doesn't work and it only tell you this in the logs not in the browser. I've had this happen and it was frustrating as heck. Might help.
  15. Try changing the "order by count()" to what you named the initial count in the columns area... ...ORDER BY posts...
  16. Might want to look at parseurl() http://us3.php.net/manual/en/function.parse-url.php
  17. Might take a look at filectime() http://us3.php.net/manual/en/function.filectime.php I just found it...didn't even know it existed! Also chech the filesystem section of the php documentation http://us3.php.net/manual/en/ref.filesystem.php
  18. One word AJAX Seems like you want to execute serverside code (PHP) without making an HTTP transaction? AJAX will do it very easily (which does make HTTP requests but in the background from a JS call). Otherwise, you will need to stick to JS, but then of course you can't make any db queries.
  19. I suppose you could do it the easy way....echo exec('ls -lc $filename'); Not all that elegant, but it works.
  20. I think bljepp69's approach is the best, process it within the same page. It's not the most efficient, but it certainly is the easiest. But you could also keep the frontend seperate from the logic through a simple require_once(). Require your calculate.php file at the top of the form page then you still have access to all the variables you initially posted. Change the form action to the form page of course...
  21. Well your first problem seems to be that your using IIS...okok, j/k Check your php.ini file. Be sure your not still using the PHP4 one for some strange reason. Then check the session.save_path value. Works fine under *nix but this must be changed for Microcrap boxes. It's right there in the file as to why.
  22. You're going to have to clarify on that a bit... Do you mean check the length then see if the value for the length is the actual value repeated that many times???? <?php $str = $_POST['num'] $length = strlen($str); if(($str == $length) && ($str == str_repeat($length, $length))){   //Condition is true } ?> I think that will work. Of course that will only work on numbers under 10
×
×
  • 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.