Jump to content

Vizor

Members
  • Posts

    38
  • Joined

  • Last visited

    Never

About Vizor

  • Birthday 05/06/1989

Contact Methods

  • Website URL
    http://acodemics.co.uk/

Profile Information

  • Gender
    Male

Vizor's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. It's not the select tag that takes the value option it's the options themselves. For example it should be: <select name="select_box"> <option value="1">1</option> <option value="2">2</option> </select> One way of getting the select box to show the selected option would be to turn the whole select part into a string and then use str_replace to add a selected="selected" attribute. <?php $select = '<select name="select_box"> <option value="1">1</option> <option value="2">2</option> </select>'; $selected_value = '2'; $select = str_replace($selected_value . '">', $selected_value . '" selected="selected">', $select); echo $select; ?>
  2. How is the date column set up? is it a timestamp value? if it is then you can just do SELECT * FROM articles ORDER BY date DESC LIMIT 5;
  3. Third result from google. http://www.tizag.com/javascriptT/javascriptconfirm.php Javascript is client side and PHP is server side, you can't mix the two. You could use javascript to confirm whether a user wants to do something then if they do redirect to a PHP page that does whatever they wanted.
  4. As far as I know you can't but you can with javascript so you could check with javascript whether it's there and redirect to different pages accordingly.
  5. Sorry, I didn't read your post properly. well, one thing you could do is: <?php $text = '<p>This is some text. <p>Another paragraph</p> Some more text</p>'; if(substr($text, 0,3) == '<p>' && substr($text, -4) == '</p>') { $text = substr($text, 3); $text = substr($text, 0, -4); } echo $text; ?>
  6. Post the error message...
  7. If you print_r($_POST); you will see it goes on name=>value for it's information. ID is a HTML attribute that can be used by other languages for example javascript.
  8. You could use strip_tags() and then add <p> and </p> to the beginning and end of your text.
  9. You need to encode < and > or at least handle them in some way else your script is ripe for exploitation, if you want the user to see < and > in the page then they must be encoded to < and > respectively, if you want to create hyperlinks then they are left as < and > in the source.
  10. Vizor

    need help

    <!-- blah --> comments things in HTML not PHP. To comment in php you can use // or # for a line comment or /* lots of lines */ for a block of code.
  11. Um, the die() function will stop all script execution and in this case output mysql_error(). Yes you read the error right you have a < that shouldn't be there or is in the wrong place.
  12. A common problem with header() saying that output has already started is that you have a space at the end of your PHP block, e.g. after ?> just highlight everything in a text editor and look for extra spaces as these count as output.
  13. Vizor

    crontab help me

    @DarkWater: So are you. It depends whether or not you add #! /usr/bin/php to the start of your script and then chmod +x it; if you do that then you don't need to specify that it's to be run through the php parser.
  14. Try using file_exists() instead of is_dir() also it might be a problem with whatever code is in your else block unless you're having problems with that basic script that you posted.
  15. Vizor

    crontab help me

    Crontab has the format m h dom mon dow command so if you wanted a script to execute every tuesday you would put in your crontab * * * * 2 /home/bin/script.php I'm sure you could work the rest out for yourself.
×
×
  • 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.