how to show an array, by post

0

I'm trying to insert and send some data through url, but I do not have the result, with a specific variable.

require('conex.php');
mysql_connect($host,$user,$pass);
mysql_select_db($database) ;

if( isset($_POST["MM_insert"])){ 
  for($i=0; $i<count($_POST['id_foto']); $i++){
    $query=mysql_query("INSERT INTO sms (id_foto, alumno, responsable1, responsable2, estado_sms, concepto, fecha, mobile) values ('".$_POST['id'][$i]."','".$_POST['nombre'][$i]."','".$_POST['dato1'][$i]."','".$_POST['dato2'][$i]."','".$_POST['estado'][$i]."','".$_POST['concepto'][$i]."','".$_POST['fecha'][$i]."','".$_POST['mobile'][$i]."') ") or die(mysql_error());
    $msg=$_POST['mensaje'];
    $mob=$_POST['mobile'][$i];

    header("Location: ../../enviosms.php?user=".$usuario."&pass=".$pass."&msg=".$msg."&telf=".print_r($mob, TRUE)."");

  }

}

I explain the code a bit,

What I do here is to receive by post, all very well up there, but when I send the mobiles and capture them, using an array to capture them online such as three telephone numbers: (188997089881879865678918097655432) but not it has been possible for me.

What I would like to be able to do is capture these numbers side by side and include the comma, (example 18899708988,18798656789,18097655432) but I have not succeeded, I can be doing wrong, some guide please and thank you for your time

    
asked by Alexander Quiroz 16.06.2016 в 16:19
source

2 answers

1

Thanks for the orientations, I solved it by converting the array into a string, and it worked perfectly, I leave the code in case it can help someone

require('conex.php');
mysql_connect($host,$user,$pass);
mysql_select_db($database) ;

if( isset($_POST["MM_insert"])){ 
  for($i=0; $i<count($_POST['id_foto']); $i++){
    $query=mysql_query("INSERT INTO sms (id_foto, alumno, responsable1, responsable2, estado_sms, concepto, fecha, mobile) values ('".$_POST['id'][$i]."','".$_POST['nombre'][$i]."','".$_POST['dato1'][$i]."','".$_POST['dato2'][$i]."','".$_POST['estado'][$i]."','".$_POST['concepto'][$i]."','".$_POST['fecha'][$i]."','".$_POST['mobile'][$i]."') ") or die(mysql_error());
    $msg=$_POST['mensaje'];
    $mob=implode($_POST['mobile']);
    header("Location: ../../enviosms.php?user=".$usuario."&pass=".$pass."&msg=".$msg."&telf=".$mob."");

  }

}
    
answered by 18.06.2016 / 21:06
source
0

pass your variable as an array to the get

something like this:

header("Location: ../../enviosms.php?user=".$usuario."&pass=".$pass."&msg=".$msg."&telf[]=".$mob);

greetings

    
answered by 16.06.2016 в 17:19