Jump to content

ucffool

Members
  • Posts

    100
  • Joined

  • Last visited

Everything posted by ucffool

  1. Um, not, you are wrong. just SELECTED is necessary. http://htmlhelp.com/reference/html40/forms/option.html
  2. sure, given the limited information supplied.
  3. Just to clarify, in the table you have the user account information and a number that represents a change_id. In another table, there is change_id and its value change_value? Could we get a sample of what the tables you are pulling from look like?
  4. Yeah, if you are using the iframe to call the page it is not included as part of the current page or script. You should be setting the iframe and then using include() to bring in products.php, which should be able to process it properly.
  5. You want to place the SELECTED statement within the option. The quick and dirty way would be: <!-- $_SERVER['HTTP_REFERER'] will show the page they came from --> <select name='subjects' id='subjects'> <option <?php if ($_SERVER['HTTP_REFERER'] == 'urlofapage') { echo 'SELECTED'; } ?> value='brochure'>Request a brochure</option> <option <?php if ($_SERVER['HTTP_REFERER'] == 'urlofadifferentpage') { echo 'SELECTED'; } ?> value='complaint'>Make a complaint</option> <option <?php if ($_SERVER['HTTP_REFERER'] == 'urlofanotherpage') { echo 'SELECTED'; } ?> value='suggestion'>Make a suggestion</option> </select>
  6. You're absolutely right, that's what I get for typing it before I shutdown and go home. sorry about that.
  7. Just to save you the headache, use of header() has to occur prior to any other output. Usually, that's not the case so you should start the TOP of your page with: <?php ob_start() ?> So your output is in an output buffer, and if you use <?php header( Location: 'http://www.example.com' ); ?> It is automatically sent first by the output buffer because you started with ob_start();
  8. You just want to pass the entire query string on to the next page? <?php // if the page was http://www.example.com/index.php?view=resolved&expand=yes // $_SERVER[QUERY_STRING] = view=resolved&expand=yes $mylink = $_SERVER[php_SELF] . '?' . $_SERVER[QUERY_STRING]; ?>
  9. web 2.0 as you put it is more commonly known for its AJAX moreso than anything else. To answer your question, if you are coding for a purpose, causing you to do some critical thinking and problem solving, you can get comfortable within 6 months and I would say intermediate level within a year with PHP. It really depends on the amount of time dedicated to it.
  10. From PHP.NET as reference: <?php // The message $message = "Line 1\nLine 2\nLine 3"; // In case any of our lines are larger than 70 characters, we should use wordwrap() $message = wordwrap($message, 70); // Send mail('caffinated@example.com', 'My Subject', $message); ?> You are using single quotes around variables, when I assume you wanted to actually send the value of the variable, not the name of the variable literally. <?php // for readability: $subject = 'TundraIRC Advertisements'; $message = "Someone wants to advertise on tundraIRC: $firstname $lastname $company website $email"; if (mail($email , $subject,$message)) { echo "<h4>Thank you for sending email</h4>"; } else { echo "<h4>Can't send email to $email</h4>"; }?> At this point, you should see one of the two echo commands since mail() returns TRUE if there was nothing wrong with the function's request to send the email, but that doesn't confirm the email will actually reach its destination.
  11. Just pull the record of all the ones that are <30, then when the id is for the record that should be <20, check its value and either process it or toss it out. No big deal to pull 1 extra record from MySQL, just process all 12 with a catch for the special circumstance.
  12. Can't you simply use mod_rewrite to stop people from hotlinking?
  13. I don't see anything wrong with the code. I did this to the code and got the expected output: function display_photos() { /*$propertyaddress = $_GET['pa']; $userfolder = $_SESSION['valid_user']; $dir = 'members/' . $userfolder . '/' . $propertyaddress . '/'; $files = scandir($dir); $i = 0; foreach($files as $value) { // check for image files if(valid_image_file($value)) // build image array $imgarr[$i] = $value; $i++; } */$imgarr = array('one','two','three','four','five'); $count = count($imgarr); for($j = 0; $j < $count; $j++) { if($j == 0 || $j%5 == 0) // echo '<div class="lastrowcol"><img src="' . $dir . $imgarr[$j] . '" width="100" height="100" /></div>'; // else // echo '<div class="floatright"><img src="' . $dir . $imgarr[$j] . '" width="100" /></div>'; echo '<div class="lastrowcol">' . $imgarr[$j] . '</div>'; else echo '<div class="floatright">' . $imgarr[$j] . '</div>'; } } display_photos(); // output (not source code output, which has all the div tags too) one two three four five So, check the source code to see how it may differ. Otherwise, before $count=count($imgarr); also add in: echo '<pre>'; print_r($imgarr); echo '</pre>'; Just to double-check things.
  14. Can you use parse_str() http://www.php.net/manual/en/function.parse-str.php or parse_url() http://www.php.net/manual/en/function.parse-url.php Rather than a regular expression?
  15. So you basically want to: $query = "SELECT ProductNo,ProductName,Dispay,Price FROM product"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)): echo "<td>" . $row[ProductNo] . "</td>"; echo "<td>" . $row[ProductNName] . "</td>"; echo "<td>" . $row[Display] . "</td>"; echo "<td>" . $row[Price] . "</td>"; endwhile;
  16. Instead of thinking about restarting a loop, why not put it in a loop and based on the results, EXITING the loop. That will give you the same results. $loopme = 0; while ($loopme == 0): // Code runs here if ($readytoexit): $loopme = 1; endif; endwhile;
  17. I fear I don't know enough about the database to say if there is a better way to pull the data you need (which is probably what you need). If it does take a while, how often does the output of this script CHANGE? If not often, could you put the output into a flat file and just read that regularly, and run this script daily?
  18. You could write the regex with a PHP variable called $whitelist, that is stored in your database. Basically, taking entries in the database, processing the mysql output into an array, then impoding the array into $whitelist with the | as the delimiter. DB: id - site 1 - youtube 2 - break $whitelist_array = array(); $query = "SELECT site FROM whitelist"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)): $whitelist[] = $row['site']; endwhile; $whitelist = implode('|',$whitelist_array); if (eregi("($whitelist)", $user_input_trimmed)){ // allow it } And yes, in the above example, I could have used mysql_fetch_result to be more efficient, just made a choice.
  19. ucffool

    Regex Help

    Do you want the INPUT to have quotes or the OUTPUT? If it is the output, that would be pretty straightforward and not part of the regex. If it is the input, you could make it something like: eregi ("^/(ban|color|invisible) ('[a-z0-9_-]') ('[a-z0-9]')", $message, $cmd Using eregi so it ignores case.
  20. That means that your expression: if ($getlink == $link) { is not evaluating as TRUE, because per your output, $getlink is empty or "", and $link = bb1dd8ff5cfa7a62010a1f586d0dfa27 So you need to evaluate where $getlink is going wrong.
  21. Remember, you can pull more information through your MySQL query than you will be showing the user directly. $query = " SELECT matches.name, opponents.name, opponents.id FROM matches, opponents WHERE matches.name = opponents.name "
×
×
  • 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.