PHP Header location

case 'simpanbarang':
	$kode_barang = $_REQUEST['kode_barang'];
	$kode_trx_pembelian = $_REQUEST['kode_trx_pembelian'];
	$jml_beli = $_REQUEST['jml_beli'];
		
	mysqli_query($koneksi,"insert into pembelian(KODE_BARANG,KODE_TRX_PEMBELIAN,JUMLAH_PEMBELIAN) values ('$kode_barang','$kode_trx_pembelian','$jml_beli')");
	header("location:?page=detail&id=".$kode_trx_pembelian);
	break;
Saat dijalankan error dan muncul "Warning: Header may not contain more than a single header, new line detected"
avatar Mahasiswa

@Mahasiswa

1 Kontribusi 0 Poin


Jawaban

di coba mas 
header("Location: ?page=detail&id=" . $kode_trx_pembelian);
avatar mfndi

@mfndi

2 Kontribusi 0 Poin


$code = "?page=detail&id='$kode_trx_pembelian'"; 
$url=str_replace(PHP_EOL,'', $code");
header("Location: $url);

coba lagi mas ini
avatar mfndi

@mfndi

2 Kontribusi 0 Poin


Login untuk gabung berdiskusi