Reseller Domain Murah dan termurah di Indonesia? ya di ResellerCamp.
         
 

Forum PHP Indonesia

 
Advanced Search
   
 
Home Register FAQ Memberlist Usergroups  
 
 

Forum PHP Indonesia Forum Index PHP Help javascript gabung php
Display posts from previous:   
      All times are GMT + 7 Hours  

javascript gabung php

Post new topic  Reply to topic

Tue Nov 10, 2009 00:13
Author Message
vb_loph
PHP Programmer
PHP Programmer


Joined: 23 May 2009
Posts: 93
Location: Bandung

Post subject: javascript gabung php Reply with quote

gimn ya kl gabung javascript dgn php? saya ada kasus dimana saya hrs munculin window confirm sebelum save data ke database?

thx be4...
 
View user's profile Send private message Yahoo Messenger
      Back To Top  

Tue Nov 10, 2009 12:10
Author Message
junifar
PHP Master
PHP Master


Joined: 27 Mar 2008
Posts: 279

Post subject: Reply with quote

mungkin maksudnya AJAX kah???
_________________
Salam




Junifar Hidayat
 
View user's profile Send private message Send e-mail
      Back To Top  

Tue Nov 10, 2009 16:43
Author Message
vb_loph
PHP Programmer
PHP Programmer


Joined: 23 May 2009
Posts: 93
Location: Bandung

Post subject: Reply with quote

junifar wrote:
mungkin maksudnya AJAX kah???


pake ajax bs ya? gimn y caranya?
 
View user's profile Send private message Yahoo Messenger
      Back To Top  

Wed Nov 11, 2009 10:03
Author Message
junifar
PHP Master
PHP Master


Joined: 27 Mar 2008
Posts: 279

Post subject: Reply with quote

Ada 2 tipe bos.

- cara klasik pake javascript.
skenarionya pas di submit ditangkap menggunakan javascript lalu ditampilkan menggunakan alert konfirmation javascript
- cara yang lazim saat ini
skenarionya pas klik submit muncul window div untuk confirmation. apabila di klik oke baru di submit. cara ini menggunakan ajax. konsepnya seperti link ini http://pixeline.be/experiments/ThickboxToJqModal/ cukup rumit bagi yang belum memahaminya. Coba anda gunakan jquery, tepatnya jqmodal.


Semoga membantu
_________________
Salam




Junifar Hidayat
 
View user's profile Send private message Send e-mail
      Back To Top  

Fri Nov 13, 2009 08:32
Author Message
hlie
Super Master PHP
Super Master PHP


Joined: 10 Apr 2008
Posts: 2673
Location: Singapore

Post subject: Reply with quote

coba bikin 1 function js
function validation()
{
if(document.test.nama.value == '')
{
alert('asdsadsa');
return false;
}else{
return true;
}
}
<form name="test" action="" method="post" onsubmit="return validate();">
<input type=text name=nama >
....
....

nb : itu baru validasi awal buat front end, kl bs di validasi lg pas di php, jadi double secure..

_________________
Past is Experience,Present is Experiments,Future is Expectations,Use your Experience in your Experiments to achieve your Expectations...!!!
www.slackware.com
 
View user's profile Send private message Send e-mail Yahoo Messenger
      Back To Top  

Fri Nov 13, 2009 12:10
Author Message
fasisi
PHPnewbie
PHPnewbie


Joined: 28 Mar 2009
Posts: 17

Post subject: Reply with quote

cara menggabungkannya.. setahu saya sih tinggal di sisipkan aja code-code javascript... selayaknya menyisipkan teks lewat php misalnya echo "<form action=....".
_________________
fasisi
www.pasar-programmer.com - wadah ketemu antara programmer dan calon user
 
View user's profile Send private message Visit poster's website
      Back To Top  

Fri Nov 13, 2009 12:36
Author Message
vb_loph
PHP Programmer
PHP Programmer


Joined: 23 May 2009
Posts: 93
Location: Bandung

Post subject: Reply with quote

hlie wrote:
coba bikin 1 function js
function validation()
{
if(document.test.nama.value == '')
{
alert('asdsadsa');
return false;
}else{
return true;
}
}
<form name="test" action="" method="post" onsubmit="return validate();">
<input type=text name=nama >
....
....

nb : itu baru validasi awal buat front end, kl bs di validasi lg pas di php, jadi double secure..


validasi lg pas di php maksudnya gimn ya?

yg saya buat sih kyk gini :
Code:
<?php echo "<script>";
echo 
"konfirm=window.confirm('Anda Yakin Menyimpan Absen dengan Guru yang Berbeda?');";
echo 
"if(konfirm==true)";
echo 
"{";
echo 
"location.href ='DaftarHadir1.php?kelas=$kelas';";
echo 
"}";
echo 
"</script>"?>


tapi yg saya bingung.. kalau saya menggunakan coding ini, saya ga bisa kirim data yg bentuknya array?
 
View user's profile Send private message Yahoo Messenger
      Back To Top  

Sat Nov 14, 2009 09:44
Author Message
fasisi
PHPnewbie
PHPnewbie


Joined: 28 Mar 2009
Posts: 17

Post subject: Reply with quote

@vb_loph

saya juga tidak begitu paham dengan javascript... tapi punya dugaan kamu bisa kirim data form lewat perintah javascript.

waktu bikin form kan ada tag <form> dan ada namanya kan? nah, di javascript kayaknya form itu dianggap sebagai objek.

nah, mungkin objek itu bisa submit pakai fungsi di javascript. mungkin perlu cari informasi lebih banyak tentang javascript.

maaf tidak bisa membantu banyak.
_________________
fasisi
www.pasar-programmer.com - wadah ketemu antara programmer dan calon user
 
View user's profile Send private message Visit poster's website
      Back To Top  

Sat Nov 21, 2009 11:42
Author Message
vb_loph
PHP Programmer
PHP Programmer


Joined: 23 May 2009
Posts: 93
Location: Bandung

Post subject: Reply with quote

fasisi wrote:
@vb_loph

saya juga tidak begitu paham dengan javascript... tapi punya dugaan kamu bisa kirim data form lewat perintah javascript.

waktu bikin form kan ada tag <form> dan ada namanya kan? nah, di javascript kayaknya form itu dianggap sebagai objek.

nah, mungkin objek itu bisa submit pakai fungsi di javascript. mungkin perlu cari informasi lebih banyak tentang javascript.

maaf tidak bisa membantu banyak.


iya.. thx infonya.. tapi yang saya bingung, apakah javacript bisa mengirim array?
 
View user's profile Send private message Yahoo Messenger
      Back To Top  

Tue Nov 24, 2009 10:50
Author Message
vb_loph
PHP Programmer
PHP Programmer


Joined: 23 May 2009
Posts: 93
Location: Bandung

Post subject: Reply with quote

ada yang tau, apakah javacript bisa mengirim array?
 
View user's profile Send private message Yahoo Messenger
      Back To Top  

Tue Nov 24, 2009 12:19
Author Message
gecko
PHP Master
PHP Master


Joined: 17 Nov 2007
Posts: 361
Location: Trenggalek, Jatim, Indonesia

Post subject: Reply with quote

bisa..
_________________
.
.
.
.

> Status FB via device lucu via blackberry, calculator, via Santa atau bikin sendiri aja

> Tutorial PHP
 
View user's profile Send private message Visit poster's website Yahoo Messenger
      Back To Top  

Tue Nov 24, 2009 18:07
Author Message
vb_loph
PHP Programmer
PHP Programmer


Joined: 23 May 2009
Posts: 93
Location: Bandung

Post subject: Reply with quote

gecko wrote:
bisa..


gimn ya caranya? blh minta cthnya?
 
View user's profile Send private message Yahoo Messenger
      Back To Top  

Tue Nov 24, 2009 22:39
Author Message
ayam_jago
PHP Programmer
PHP Programmer


Joined: 26 Oct 2009
Posts: 92
Location: Lampung

Post subject: Klik aja Reply with quote

vb_loph wrote:
gecko wrote:
bisa..


gimn ya caranya? blh minta cthnya?


ya itu di click aja www.gecko.web.id Big Smile
_________________
MyBLOG
 
View user's profile Send private message Visit poster's website Yahoo Messenger
      Back To Top  

Wed Nov 25, 2009 01:35
Author Message
kebeng
PHP Programmer
PHP Programmer


Joined: 09 Aug 2009
Posts: 75
Location: jakarta

Post subject: Reply with quote

Oke bos bos..
saya jg ga bisa javascript..
ini script php nya... hail
Code:
<?php <script language="JavaScript" src="script/script.js"></script>
<form name="fm12" action="13.php" method="post"  onSubmit="return cek12();">
<table align="center">
<tr><th>No</th><th>NIM</th><th>Tahun</th><th>Semester</th></tr>
<?
for ($i=0$i<$jumlah$i++)
{
$n=$i+1?>
<tr><td align="center"><?=$n?></td>
    <td align="center"><select name="nim[]">
    <option value="">Pilih</option>
    <? include"konek.php";
    
$c=mysql_query("select * from siswa where status like '%aktif%' order by nim DESC");
    while(
$e=mysql_fetch_array($c))
    {
    echo
"<option value=\"$e[nim]\">$e[nim]</option>";
    } 
?> </select></td>
    
    <td align="center"><? $t=date("Y");
        { echo
"<input type=\"text\" size=\"4\" name=\"tahun[]\" value=\"$t\">";  }
        
?></td>
        
    <td align="center"><select name="semester[]">
    <option value="">Pilih</option>
    <option value=1>Ganjil</option>
    <option value=2>Genap</option>
    </select></td></tr>
<? }
echo 
"<tr><td colspan=6 align=center><input type=submit value=Simpan name=simpan></td></tr>";
?>
</table></form> ?>


Dan ini javascript nya bos....
Code:
<?php function cek12()
{
   
with(document.fm12)
   {
       if(
nim[].value=="")
      {
           
alert("Maaf no induk belum diisi !")        
           
nim[].focus();
           return 
false;     
      }
       if(
tahun[].value=="")
      {
           
alert("Maaf tahun belum diisi !")        
           
tahun[].focus();
           return 
false;     
      }
       if(
semester[].value=="")
      {
           
alert("Maaf semester belum diisi !")        
           
semester[].focus();
           return 
false;     
      }
    }
?>


saya uda pake while n for untuk js nya..
Code:
<?php $i=1;
while (
$i<n)
$i++;
//atau
var i,n;
for(
i=0i<ni++); ?>

tapi variabel 'n' dari for dan while saya ga tw gimana bawa nilai 'n' dari php ke js..
tapi memang karna saya ga bisa js jadi saya ga bisa-bisa bos..
Mohon bos bos mengkoreksi javascript y saya, jangan2 emang js saya nya terlalu ngaco.. :(
Helppp!!
Helppp!! hail


Maaf bos vb_loph,saya numpang bertanya di c bos..tapi...
vb_loph wrote:
hlie wrote:
coba bikin 1 function js
function validation()
{
if(document.test.nama.value == '')
{
alert('asdsadsa');
return false;
}else{
return true;
}
}
<form name="test" action="" method="post" onsubmit="return validate();">
<input type=text name=nama >
....
....

nb : itu baru validasi awal buat front end, kl bs di validasi lg pas di php, jadi double secure..



yg saya buat sih kyk gini :
Code:
<?php echo "<script>";
echo 
"konfirm=window.confirm('Anda Yakin Menyimpan Absen dengan Guru yang Berbeda?');";
echo 
"if(konfirm==true)";
echo 
"{";
echo 
"location.href ='DaftarHadir1.php?kelas=$kelas';";
echo 
"}";
echo 
"</script>"?>


tapi yg saya bingung.. kalau saya menggunakan coding ini, saya ga bisa kirim data yg bentuknya array?


@ bos hlie => script saya untuk perulangan input..
tapi js nya ga bisa muncul window confirm nya.. Helppp!! bos Helppp!! bos

@ bos vb_loph => mudah2n script saya menolong juga bos,
COZ c bos jg mw input data (record) berbentuk array..
_________________
:')
 
View user's profile Send private message Send e-mail Yahoo Messenger
      Back To Top  
Post new topic  Reply to topic

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


      Back To Top  

Page 1 of 1
Jump to:  
Powered by phpBB © 2001, 2002 phpBB Group
Avalanche style by What Is Real © 2004