Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PHP CheckBox
25 Nov 2007, 11:32 PM (This post was last modified: 25 Nov 2007 11:32 PM by Realmz.)
Post: #1
PHP CheckBox
Uit Bro pengan nanya nih...
PHP Code:
<?
session_start
();
if (!
$_SESSION[user])
    
header("Location: cart.php");
?>

<html>
<body bgcolor ="#9999ff">
<form action="checkout_proc.php" method="post">

<table>

<tr>
<td colspan="3" align="center">
<table width="80%"><tr><td>CONTACT INFORMATION</td></tr></table>
</td>
</tr>

<tr>
<td colspan="3" align="center">
<input type="checkbox" name="confirm"> Check apabila ingin Data sama dengan data Account
</td>
</tr>

<tr>
<td colspan="3" align="center">
<font color="red">*</font> Harus di Isi<br><br>
</td>
</tr>

<tr>
<td colspan="2" align="right"><font color="red">*</font> First name:</td>
<td>
<input type ="text" name ="user" value="" ReadOnly>");
</td>
</tr>
<tr>
<td colspan="2" align="right"><font color="red">*</font> Email:</td>
<td><input type="text" name="email" value=""></td>
</tr>
<tr>
<td colspan="2" align="right">Phone number:</td>
<td><input type="text" name="phone" value=""></td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td colspan="2" align="right">Address:</td>
<td><textarea name="address" rows="4"></textarea></td>
</tr>
<tr>
<td colspan="2" align="right"><font color="red">*</font> Kota:</td>
<td><input type="text" name="city" value=""></td>
</tr>
<tr>
<td colspan="2" align="right"><font color="red">*</font> Kode Pos:</td>
<td><input type="text" name="zip" value=""></td>
</tr>

</table>

<p>
<input type="submit" value="Confirm">

<input type="hidden" name="complete_order" value="1">
</p>

</form>
</body>
</html> 

Nah gw pengen kalo gw cek checkbox yg ada textbox yang ada itu lsg terisi semua tanpa harus klik submit dulu... Tau ga gimana cara?
Helep dunk bro baru pertama kali nyentuh PHP nih
Find all posts by this user
Quote this message in a reply
26 Nov 2007, 02:44 PM (This post was last modified: 26 Nov 2007 02:45 PM by digimaster.)
Post: #2
RE: PHP CheckBox
Hmmm, klo masalah yang kaya u bilang itu kayanya harus pake javascript + PHP. Thinking Apalagi klo semua field yang ada langsung keisi, itu pasti musti pake JS...

My page :
1 | 2 | 3
Visit this user's website Find all posts by this user
Quote this message in a reply
26 Nov 2007, 07:19 PM
Post: #3
RE: PHP CheckBox
Bisa ga di dalem JS gitu kita tambahin PHP, misalnya :
PHP Code:
if (document.myform.checkbox.checked){
    
user = <?$_session[user]?>  } 
Ato kita harus mainin php di luar script JS?? Soalnya gw coba2 kaya yg di atas ga bisa uy... Error mulu ampe bosen
Find all posts by this user
Quote this message in a reply
27 Nov 2007, 11:15 PM
Post: #4
RE: PHP CheckBox
Bisa. Justru harusnya caranya memang begitu. Thinking

Btw penggunaan sessionnya udah bener belom? Soalnya klo pake session rada ribet sih. Big Grin Gue sendiri lebih biasa pake cookie daripada pake session.

My page :
1 | 2 | 3
Visit this user's website Find all posts by this user
Quote this message in a reply
28 Nov 2007, 09:18 AM
Post: #5
RE: PHP CheckBox
Session-nya uda di assign value-nya trus session start juga uda di paling atas. Syarat Session cuma itu doank kan. nah tapi bgitu gw pake di JS kaya posting sebelumnya, itu error melulu ampe bosen katanya kurang ";" (tanpa kutip) uda gw cek ampe mata siwer nih... masi ga jalan2 juga
Find all posts by this user
Quote this message in a reply
06 Dec 2007, 10:47 PM (This post was last modified: 06 Dec 2007 10:50 PM by digimaster.)
Post: #6
RE: PHP CheckBox
Wah iya, yang bener itu harus pake echo juga... Jadi kode di atas harus kaya gini kurang lebih:

PHP Code:
if (document.myform.checkbox.checked)
{
    
user "<?php echo $_session[user]; ?>";


Jadi pada kenyataannya memang kurang titik koma. Anyway lebih baik pake <?php daripada pake <? soalnya di beberapa server, penggunaan yang singkat ini udah dimatiin. Smile

My page :
1 | 2 | 3
Visit this user's website Find all posts by this user
Quote this message in a reply
29 Dec 2007, 12:15 PM
Post: #7
RE: PHP CheckBox
<?php tuh mendukung XML soalnya ^^

�ﺨﺗﺦﺵﻄﺳﺜﺫﺺﻉﺸﺧﺖﺥﺴ �ﺝﺬﺻﻊﺹﺨﺗﺦﺵﻄﺳﺜﺫﺺﻉ �ﺖﺥﺴﻄﺳﺤﺕﺦﺷﻈﺹﺪﺛﺬﺽ ﻎ
Visit this user's website Find all posts by this user
Quote this message in a reply
05 Jan 2008, 04:47 PM
Post: #8
RE: PHP CheckBox
Maksudnya gimana ya? Straight face

My page :
1 | 2 | 3
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: