Textarea function php pass data [closed]

1

I have a question about how I can be passing the value of a textarea to a php function.

I have the following function:

function _dup($cclist) {
        for ($i = 0; $i < count($cclist); $i++) {
                $ccnum = info($cclist[$i]);

                if (is_array($ccnum)) {
                        $cc = $ccnum['num'];
                        for ($j = $i + 1; $j < count($cclist); $j++) {
                                if (inStr(str_replace("-", "", str_replace(" ", "", $cclist[$j])), $cc))
                                        $cclist[$j] = "";
                        }
                }
        }

        foreach ($cclist as $i => $cc)
                if ($cc == "")
                        unset($cclist[$i]);

        $ok = array_values($cclist);
        return $ok;
}

And to execute the script I have this other function:

function check($ccnum, $ccmonth, $ccyear, $cccvv) {
        $ccline = $ccnum."|".$ccmonth."|".$ccyear."|".$cccvv;
        $action = new Run();
        $action->addToCart();
        $action->CCLINE = $ccline;
        return $action->checkOut();
}

The texarea will get the value nome|cpf|mae|data so that the check function can validate it.

HTML

<form action="" method=post name=f> <textarea wrap="off" name=cclist cols=90 rows=20> </textarea><br> <br> <input style="width:100px" class="button" type=submit name=submit size=10 value="Valida"> </form> 
    
asked by anonymous 16.03.2015 / 09:55

1 answer

1

Your question is confusing, but answering the question:

  

How can I be passing the value of a textarea to a function of the   php.?   It would look like this:

HTML

<form action="" method=post name=f>
<textarea wrap="off" name=cclist cols=90 rows=20> </textarea><br> <br>
<input style="width:100px" class="button" type=submit name=submit size=10 value="Valida"> 
</form> 

PHP

<?php
function nomeFuncao(){
   $cclist =  $_POST['cclist'];

Then to separate the name | cpf | mother | date values if they are separated by | It's easy:

    $cclist_separados = explode("|", $cclist);
    print_r($cclist_separados);
}
    
17.04.2015 / 16:22