View: 4222|Reply: 16
|
Macam mana nak combine javascript dengan php
[Copy link]
|
|
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. |
|
|
|
|
|
|
|
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. |
|
|
|
|
|
|
|
nak combine senang je... n contoh- <?php
-
- $today = date('d/m/Y H:m:s');
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>Untitled Document</title>
- <script type="text/javascript">
- alert("Today is <?= $today ?>");
- </script>
- </head>
- <body>
- </body>
- </html>
Copy the Code |
|
|
|
|
|
|
|
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 4# BorderManager
da buat,tapi xde ape2 perubahan,masih 4 jam awal.huhu |
|
|
|
|
|
|
|
Kalau guna PHP, tarikh dan waktu ikut server (pelayan). Kalau nak tarikh dan waktu ikut PC, gunakanlah JavaScript.
Contoh:
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>contoh</title>
- </head>
- <body>
- tarikh dan waktu sekarang ialah: <span id="foo"></span>
- <script type="text/javascript">
- //<![CDATA[
- var now = new Date();
- document.getElementById("foo").innerHTML = now;
- //]]>
- </script>
- </body>
- </html>
Copy the Code |
|
|
|
|
|
|
|
Reply 6# meritokrasi
terima kasih |
|
|
|
|
|
|
|
apa beza php ngan html ? |
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
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> |
|
|
|
|
|
|
|
action tu satu page je...... cth form_action.php, dlm form_action.php ko redirect la guna header |
|
|
|
|
|
|
|
Reply 11# BorderManager
ok done,yg ni aku guna include ' ' |
|
|
|
|
|
|
|
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 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. |
|
|
|
|
|
|
|
buat je 2 kali query
- $sqlDel = "DELETE FROM booking WHERE booking_id='$bookID'";
- mysql_query($sqlDel);
- $sqlDel = "DELETE FROM booking_item WHERE booking_id='$bookID'";
- mysql_query($sqlDel);
Copy the Code |
|
|
|
|
|
|
|
Reply 16# BorderManager
done tht,smalam...tenkiuu |
|
|
|
|
|
|
| |
|