Postingan lainnya
Kenapa di vidio Register & Login PHP (OOP), 6 (memulai registrasi user), tidak mau bekerja
ada 3 halaman yaitu init.php, input.php, register.php
Kenapa pada halaman register.php If nya tidak bekerja ?, yang dipanggil dari class input (input.php), padahal semua sudah direquire oleh init.php dan di register.php sudah require init.php
Halaman init.php
<?php
session_start();
spl_autoload_register(function($class){
require_once "classes/" .$class. ".php";
});
?>
Halaman input.php yang berada pada folder classes
<?php
class Input{
public static function get($name){
if( isset($_POST[$name]) ){
return $_POST[$name];
}
elseif(isset($_GET[$name])){
return $_GET[$name];
}
return false;
}
}
?>
Halaman register.php
<?php
require_once "core/init.php";
if(Input::get('register')){
echo Input::get('username');
}
require_once "templates/header.php";
?>
<form action="register.php" method="post">
<table>
<tr>
<td> Username </td>
<td> : </td>
<td> <input type="text" name="username"> </td>
</tr>
<tr>
<td> Password </td>
<td> : </td>
<td> <input type="password" name="password"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> <button type="submit" name="register"> Daftar sekarang </button> </td>
</tr>
</table>
</form>
<?php
require_once "templates/footer.php";
?>
Mohon bantuannya gan ! Nanti saya berikan coto 1 Coto sangat berharga ^_^
5 Jawaban:
Hmm sudah tak isi nilai di inputannya tp websitenya hanya ngereload tidak menampilkan nilainya
Jawaban Terpilih
<button type="submit" name="register" value="register"> Daftar sekarang </button>
soalnya kan yang di return nilai,, jadi kalau submit nya gk dikasih attribute VALUE ya dianggap ngk ke set
coto mana coto.. hehe..
Happy Sharing (^_^)
Wah akhirnya bisa thanks bang, diterima cotonya bang