CARI Infonet

 Forgot password?
 Register

ADVERTISEMENT

View: 4123|Reply: 16

Macam mana nak combine javascript dengan php

[Copy link]
Post time 3-11-2010 01:33 AM | Show all posts |Read mode
aku skunk tengah belajar buat website..masalah aku skunk tak tau macam mana nak combine php dengan javascript.Contoh yang kalau melibat function 'Search'.

Ada contoh tak?Aku dah google,tapi macam x berapa nak jelaslah.
Reply

Use magic Report


ADVERTISEMENT


 Author| Post time 3-11-2010 10:59 AM | Show all posts
lagi  satu nak tanya,

ni code php untuk masa

<?php
echo date("g:i");
?>

problemnye skunk,masa yang keluar x sama dengan waktu pc aku.

Aku dah try edit file php.ini,tapi  x berjaya,ke aku salah edit,xtau la kan.

harap2 ada yang sudi membantu.
Reply

Use magic Report

Post time 3-11-2010 12:17 PM | Show all posts
nak combine senang je... n contoh
  1. <?php
  2.        
  3.         $today = date('d/m/Y H:m:s');

  4. ?>
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  9. <title>Untitled Document</title>
  10. <script type="text/javascript">
  11.         alert("Today is <?= $today ?>");
  12. </script>
  13. </head>

  14. <body>
  15. </body>
  16. </html>
Copy the Code
Reply

Use magic Report

Post time 3-11-2010 12:20 PM | Show all posts
lagi  satu nak tanya,

ni code php untuk masa



problemnye skunk,masa yang keluar x sama deng ...
mosti Post at 3-11-2010 10:59



dah set timezone kat php.ini
cari date.timezone = "Asia/Kuala_Lumpur"
Reply

Use magic Report

 Author| Post time 3-11-2010 12:57 PM | Show all posts
Reply 4# BorderManager


    da buat,tapi xde ape2 perubahan,masih 4 jam awal.huhu
Reply

Use magic Report

Post time 21-11-2010 06:52 PM | Show all posts
Kalau guna PHP, tarikh dan waktu ikut server (pelayan). Kalau nak tarikh dan waktu ikut PC, gunakanlah JavaScript.

Contoh:


  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4.     <head>
  5.         <title>contoh</title>
  6.     </head>
  7.     <body>
  8. tarikh dan waktu sekarang ialah: <span id="foo"></span>

  9. <script type="text/javascript">
  10. //<![CDATA[
  11. var now = new Date();
  12. document.getElementById("foo").innerHTML = now;
  13. //]]>
  14. </script>
  15.     </body>
  16. </html>
Copy the Code
Reply

Use magic Report

Follow Us
 Author| Post time 29-11-2010 10:08 AM | Show all posts
Reply 6# meritokrasi


    terima kasih
Reply

Use magic Report

Post time 13-12-2010 03:44 PM | Show all posts
apa beza php ngan html ?
Reply

Use magic Report


ADVERTISEMENT


Post time 13-12-2010 11:07 PM | Show all posts
apa beza php ngan html ?
winamp05 Post at 13-12-2010 15:44



html tu static page, client script.....apa yg ko tulis dlm code tu.. tu la client ko leh baca
php lak dynamic page, server script... apa yg ko tulis dlm code...server akan proses dulu & output dia dlm bentuk html
Reply

Use magic Report

 Author| Post time 14-12-2010 07:20 AM | Show all posts
Post Last Edit by mosti at 14-12-2010 07:23

Reply 9# BorderManager


    aku nak tanya..adakah possible untuk aku proses 2 script dalam satu form:-


<html>
<body>

<form action="form_action.php","script_action.php" method="post">

First name: <input type="text" name="FirstName" value="Mickey" /><br />
Last name: <input type="text" name="LastName" value="Mouse" /><br />
<input type="submit" value="Submit" />
</form>

<p>Click the "Submit" button and the input will be sent to a page on the server called "form_action.asp".</p>

</body>
</html>
Reply

Use magic Report

Post time 14-12-2010 08:19 AM | Show all posts
action tu satu page je...... cth form_action.php, dlm form_action.php ko redirect la guna header
Reply

Use magic Report

 Author| Post time 14-12-2010 10:13 PM | Show all posts
Reply 11# BorderManager


    ok done,yg ni aku guna include ' '
Reply

Use magic Report

 Author| Post time 14-12-2010 10:15 PM | Show all posts

lagi satu aku try buat kalu password tu tak match dengan password lagi satu,automatik die akan kuar message error,tp bila guna code di bawah error x kuar lansung


if($password != $confirm_password) {
                $errmsg_arr[] = '*Password and Confirm Password did not match';
                $errflag = true;
        }else {//If there are input validations, redirect back to the registration form
        $_SESSION['ERRMSG_ARR'] = $errmsg_arr;
                session_write_close();
                header("location: register.php");
                exit();
                }
Reply

Use magic Report

Post time 16-12-2010 08:26 AM | Show all posts
bagi full page script
Reply

Use magic Report

 Author| Post time 26-12-2010 01:09 PM | Show all posts
Reply 14# BorderManager


    yang error tu aku da dapat,punca dia sebab aku x declare error var.

Ada lagi satu soklan,

camne nak delete data dari dua table based on booking_id.

yang skunk ni aku buat--> $sqlDel = "DELETE FROM booking WHERE booking_id='$bookID'";

Hanya boleh delete dari satu table je.
Reply

Use magic Report

Post time 27-12-2010 03:03 AM | Show all posts
buat je 2 kali query

  1. $sqlDel = "DELETE FROM booking WHERE booking_id='$bookID'";
  2. mysql_query($sqlDel);
  3. $sqlDel = "DELETE FROM booking_item WHERE booking_id='$bookID'";
  4. mysql_query($sqlDel);
Copy the Code
Reply

Use magic Report


ADVERTISEMENT


 Author| Post time 27-12-2010 09:22 AM | Show all posts
Reply 16# BorderManager


    done tht,smalam...tenkiuu
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT



 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CARI Infonet

4-5-2024 10:06 AM GMT+8 , Processed in 0.076784 second(s), 43 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list