Welcome to the Linux Foundation Forum!

php user input

hi,

i want to take user inputs from the command line using php. i have google around but all the examples of input are web based so need some help for this

usmangt

Comments

  • saqman2060
    saqman2060 Posts: 777
    Are you saying you want to copy user commands from the terminal and put them in a php frame. In other words, what ever the user types in the command line, shows up simultaneously in php? When you say php, do you mean the frame or a site?
  • usmangt
    usmangt Posts: 42
    well the user input will not be used for some website. what i am trying to achieve is that to get the input from the command line argument e.g.

    ./file.php 23 45 29

    so that i can save these three input values in my script for their sum calculation
  • mfillpot
    mfillpot Posts: 2,177
    usmangt wrote:
    well the user input will not be used for some website. what i am trying to achieve is that to get the input from the command line argument e.g.

    ./file.php 23 45 29

    so that i can save these three input values in my script for their sum calculation

    Have you thought about using using sed and a generic file with temp values that can be overwritten by sed, then copy the newly modified file over the original?
  • Try

    <?php
    var_dump($argv);
    ?>


Categories

Upcoming Training