Jump to content

mostafatalebi

Members
  • Posts

    200
  • Joined

  • Last visited

Posts posted by mostafatalebi

  1. Hello everybody

     

    I have made an upload form. I need to limit the file-support to several types.

    PDF DOCX DOC ZIP RAR

     

    What shall I do? I search the whole net and reach at no specific result.

     

    How can I validate these specific files. Is pathinfo(PATHINFO_EXTENSION) enough? and if yes, how ?

  2. Hello everybody

     

    I need a function in my site that calculates the period between two dates. How shall I approach this?

     

    $date_1 - $date_2 = $period

     

    I want to be able to get a time in clean appearance. Such as: 2 Days and 3 Hours

     

    Thanks in advance

  3. Hello everybody

     

    I have a file input in my upload form. I have fully styled it so that the whole input (button+textField) is invisible and a stylish button is in place. I want to make a <p> or a <div> or anything else to put in that the path of the selected file. How can I approach this?

     

    thanks

  4. Hello

     

    How I can write functions in PHP which could have any number of arguments, and not a limited number, or a fixed/predefined number.

    for instance:

     

    function doCheck ($name, $lastname)

    {

     

    }

    // the above function has two arguments and therefore is not dynamic. I want a function without any predefined number of argument and yet be able to receive variety of arguments (of course based on its functionality.)

     

    Thanks in advance

  5. Hello everybody

     

    I have to get data from a table and arrange them in a descending order, so that the greater IDs be first in the array.

     

    And I need to know that whether I have to use fetch_array or regular fetch().

     

    thanks in advance

  6. This is my code

     

    <body>
    
    <form action="" method="post" name="exm">
    <input type="text" name="name">
    <input type="text" name="x">
    <input type="text" name="y">
    <input type="text" name="z">
    <input type="submit" name="submit" />
    <script type='text/javascript' >
    
    function formValue ()
       {
               document.forms['exm'].elements.value= "AAA";
       }
    formValue;    
    </script>
    </form>
    </body>
    

  7. Hello I have to add persian language strings to the database out of a form through PHP.

    Persian is right to left.

     

    I have set sql table to utf8_persian, and when I use SQL direct interface to insert persian data, it works, and in HTML-PHP page I have many persian strings which all smoothly are rendered. But When I get the user data from a from in persian language, and through php mysqli statement want to add them into the table, they are added in strange characters.

    I also have done mysqli_set_charset($link, "utf8");

    What shall I do?

     

     

    Thanks

  8. Hello everybody

    I have a problem in my form submission which I think could be easily solved by a pro programmer

     

    Setting:

    I have a form

    At the end of the form I have put something like a CAPTCHA. There is a question, and a text input for the user to enter the answer.

    So far everything works fine, the question is randomly generated without any problem.

     

    But as soon as the user clicks on the submit button, the script regenerates the question which naturally has a different answer than the one the user has entered. What should I do to avoid execution of the function when the form is submitted??

     

    However if somebody likes to see the script architecture here it is:

     

    function randomSentenceGenerator ()
    {
    php script
    }
    $question_and_answer_array = randomSentenceGenerator();
    if(isset($_POST['submit'])
    {
    if(question != answer)
    {
    tell user to enter a correct answer
    }
    Include the HTML
    }
    else
    {
    include the HTML
    }
    

×
×
  • 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.