skip to Main Content

So this are the array associative :

 <?php
	$buku = [
				['judul' => 'Algoritma & pemrograman menggunakan Java',
				  'reason' => 'Buku ini sangat membantu saya dalam mengembangkan skill java dan konsep algoritma yang saya peroleh.',
				  'penerbit' => 'Abdul Kadir',
				  'pic' => '<img src = "asset/buku1.jpg">'],
				  
				  ['judul' => 'Webmaster Series: JavaScript',
				  'reason' => 'Buku ini sangat membantu saya dalam mengembangkan skill JavaScript yang telah saya peroleh dari kegiatan kuliah.',
				  'penerbit' => 'Andi & Wahana Komputer', 'pic' => '<img src="asset/buku2.jpg">'],
				  
				  ['judul' => 'Zero To One',
				  'reason' => 'Buku ini sangat memotivasi saya untuk selalu meng<i>explore</i> pengetahuan / hal-hal yang baru , berkarya, dan menata masa depan agar lebih tersusun rapih sehingga membuat mimpi menjadi nyata.',
				  'penerbit' => 'Peter Thiel with Blake Masters',
				  'pic'=> '<img src="asset/buku3.jpg">'],
				  
				  ['judul' => 'Smart Trik: JQuery without plugin',
				  'reason' => 'Buku ini sangat membantu saya dalam mengembangkan skill JQuery yang telah saya peroleh dari kegiatan kuliah.',
				  'penerbit' => 'Rohy',
				  'pic'=> '<img src="asset/buku4.jpg">'],
				  
				  ['judul' => 'Pemrograman Bootstrap',
				  'reason' => 'Buku ini sangat membantu saya dalam mengembangkan skill Bootstrap dan web design agar web yang saya buat lebih interaktif terhadap Users, dengan ilmu yang telah saya peroleh dari kegiatan kuliah.',
				  'penerbit' => 'Jubilee Enterprise',
				  'pic'=> '<img src="asset/buku5.jpg">'],
				  
				  ['judul' => 'Buku Pintar Pemrograman PHP',
				  'reason' => 'Buku ini sangat membantu saya dalam mengembangkan skill php agar web yang saya buat lebih interaktif terhadap Users, dengan ilmu yang telah saya peroleh dari kegiatan kuliah.',
				  'penerbit' => 'Dodit Suprianto',
				  'pic'=> '<img src="asset/buku6.jpg">'],
				  
				  ['judul' => 'Unreal Engine 4 with C++ COOKBOOK',
				  'reason' => 'Buku ini sangat membantu saya untuk mempermudah  dalam pemembuatan game yang sedang saya buat di Software Unreal Engine 4.',
				  'penerbit' => 'William Sherif & Stephen Whittle',
				  'pic'=> '<img src="asset/buku7.jpg">'],
				  
				  ['judul' => 'Pemrograman Mobile App berbasis Android',
				  'reason' => 'Buku ini sangat membantu saya untuk menambah ilmu saya dalam pemembuatan aplikasi di Smartphone berbasis Android.',
				  'penerbit' => 'Nazruddin Safaat H',
				  'pic'=> '<img src="asset/buku8.jpg">'],
				  
				  ['judul' => 'Artificial Intelligence',
				  'reason' => 'Buku ini sangat membantu saya untuk menambah ilmu saya dalam memahami kecerdasaan perangkat lunak maupun perangkat keras.',
				  'penerbit' => 'INFORMATIKA',
				  'pic'=> '<img src="asset/buku9.jpg">'],
				  
				  ['judul' => 'Real-Time Communication with WebRTC',
				  'reason' => 'Buku ini sangat membantu saya untuk menambah ilmu saya dalam pembuatan aplikasi real-time text/video chat.',
				  'penerbit' => 'Salvatore Loreto',
				  'pic'=> '<img src="asset/buku10.jpg" >']
	
				 ];
?>

and this are printing the array inside the span in the same page with the array:

`<?php foreach ($buku as $book) :  ?>
  	<div class="frame">
	  	<span class="gambar"><?php echo $book['pic']; ?></span>	
	  	<span class="judul"><a href="latihan3.php?judul=<?=$book['judul'];?>&&reason=<?=$book['reason']; ?>&&penerbit=<?=$book['penerbit']; ?>&&pic=<?=$book['pic'];?> <?php echo $book["judul"]; ?></a> </span>
		<span class="reason"><?php echo "<u>Alasan</u> : ".$book['reason'];?></span>
	</div>
   <?php endforeach; ?>

So this are the result if i put the “> that missing on the “a” tag

then, this are the $_GET Superglobal method for catching the data of an array in different page from the array:

<ul class="profil">
				<div class="pic"><?php echo $_GET["pic"]; ?></div>
			
				<li>Judul: <?php echo $_GET["judul"]; ?></li>
				<li>Alasan: <?php echo $_GET["reason"]; ?></li>
				<li>Penerbit: <?php echo $_GET["penerbit"]; ?></li>	
			</ul>

Finally, The problem is that get superglobal doesn’t catch the picture if i click the title/judul on the span which is i already putted the link inside the title/judul class of the span…

Please help me guys, i tried for 2 days to figured this out but null result -_-

thanks in advance

3

Answers


  1. The a tag isn’t closed yet. “>” is missing before the image

    Login or Signup to reply.
  2. Why you don’t use image name only “boku7.jpg” for example, why do you need the whole html tag in your url?

    Login or Signup to reply.
  3. Dealing with your current data and code, and with this small change your application will work properly. So, Instead of using

    pic=<?=$book['pic'];?>
    

    to build your query string, just use

    pic=<?=urlencode($book['pic']);?>">
    

    The problem is that you’re trying to write some HTML characters that the browser will interpret and causes a wrong built <a> tag. This results in unintended behavior.

    But it’s recommended to abstract your data to just raw links, array of image.jpg for example, and let your application handle them.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search