Jump to content

kanchatchai

Members
  • Posts

    107
  • Joined

  • Last visited

Everything posted by kanchatchai

  1. use$_POST['age'] mysqli_query($con,"UPDATE Persons SET Age=".$_POST['age']." WHERE FirstName='Peter' AND LastName='Griffin'");
  2. I Nerver seen Flash Communication Server can do.
  3. kanchatchai

    PHP Config edit

    thanks for advice boen_robot
  4. kanchatchai

    PHP Config edit

    May be use readfile and explode.
  5. kanchatchai

    PHP help

    HAPPY NEW YEAR GIRL tableid, title, subject 1. show id as linkHere how to with databasehttp://www.w3schools...ysql_select.asp in file menu.phpwho link by code... echo '<a href="page.php?id='. $row['id'] .'">'.$row['title'].'</a>'; 2. after clicked php will accept with GEThttp://www.w3schools...php/php_get.asp in file page.php sql string...'select * from your_table_name where id='.$_GET['id'] and show record... echo '<p>'.$row['title'].'<br/>'; echo '<p>'.$row['subject'].'<br/>';
  6. you forgot to register$_SESSION['username']
  7. https://code.google.com/a/apache-extras.org/p/phpmailer/
  8. may be$_SESSION['user_id'] not set
  9. <?PHP@session_start();//This function will find and checks if your data is correct//Collect your info from login form if (isset($_REQUEST['logout']))unset($_SESSION["username"]);//Show Logout Buttonif (isset($_SESSION["username"]))echo '<form method="post" name="logoutform" action=""> Username: '.$_SESSION["username"].' <input value="logout" name="logout" type="submit"><br></form>';//Show Login Formelseif (!(isset($_POST['username'])&&isset($_POST['password']))){echo '<b>Login Form</b><br/><form method="post" name="loginform" action=""> User Name:<input name="username"><br> User Password:<input name="password" type="password"><br><input value="Login" name="submit" type="submit"><br></form>';}else{ $username = $_POST['username']; $password = $_POST['password']; //Connecting to database $connect = mysql_connect("myhost", "myuser", "mypass"); if(!$connect){ die(mysql_error()); } //Selecting database $select_db = mysql_select_db("mydatabase", $connect); if(!$select_db){ die(mysql_error()); } //check username $result = mysql_query("SELECT * FROM users WHERE username='$username'"); $row = mysql_fetch_array($result); $user = $row['username']; if($username != $user){ die('Username is wrong! <br/><a href="">Try again</a>'); } else $select_pass = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'"); while($row4 = mysql_fetch_array($select_pass)) { $_SESSION["username"] = $_POST["username"]; } if (isset($_SESSION["username"] )) echo 'Welcome, '.$_SESSION["username"].' please continue on our <a href="index.php">Index</a>'; else die('Your password is wrong! <br/><a href="">Try again</a>'); }?>
  10. Idiacreate table_visitor[visit_id] [visit_url] [visit_time] [visit_ip] create visitor file (sample insert_visitor.php) have code to insert value to table_visitor in states.php,Cities.php,Category.php,New_topic_title.php,Topic_description.phpinclude file insert_visitor.php finalyuse code to show cont and group (checkvisitor.php) SELECT Count(table_visitor.visit_id) AS CountOfvisit_id, table_visitor.visit_urlFROM table_visitorGROUP BY table_visitor.visit_url to output echo CountOfvisit_idandecho visit_url
  11. kanchatchai

    Format Number

    http://php.net/manual/en/function.number-format.php
  12. kanchatchai

    filling a form

    i mean you can see variable in addressbar after change post to getlike thishttp://ie.microsoft.com/testdrive/ieblog/2008/Sep/09_TheIE8SmartAddressBarPart1NavigateEasierandFaster_2.pngand after you see variable change to Post again.
  13. kanchatchai

    filling a form

    change <form action="register_form.php" method="post"> to <form action="register_form.php" method="GET"> and get variable you need in address bar after complete change it back
  14. in thailand i use PHP <?PHP header('Content-Type: text/html; charset=Windows-874'); ?> and HTML <meta http-equiv="Content-Type" content="text/html; charset=Windows-874"> to show header for thai language and use mysql_query("SET NAMES tis620"); to get thai charactor from mysql
  15. echo '<a name="Building Envelope Products"></a>';if (isset($_POST['id'])&&isset($_POST['update'])){if (mysql_query("UPDATE products Set category='".$_POST['category']."', familyname='".$_POST['familyname']."', family_id='".$_POST['family_id']."', subfamily_identifier='".$_POST['subfamily_identifier']."', name='".$_POST['name']."', description='".$_POST['description']."', color='".$_POST['color']."', weight='".$_POST['weight']."', list_price='".$_POST['list_price']."', inactive='".$_POST['inactive']."', button='".$_POST['button']."'WHERE id='".$_POST['id']."'")){ echo ' Record Updated.';}else { echo 'Error While Update :'.mysql_error();}}if (isset($_POST['id'])&&isset($_POST['confirm_delete'])){if (mysql_query("DELETE FROM products WHERE id='".$_POST['id']."'")){ echo '<br/>1 Record Deleded '; } else {echo 'Error While Delete: '.mysql_error(); }}if (isset($_POST['id'])&&isset($_POST['edit'])){ echo '<H1>Update products</H1>';$result_products = mysql_query("SELECT * FROM products WHERE id='".$_POST['id']."'");while($row_products = mysql_fetch_array($result_products)){ ?><form id="update_products" name="update_products" method="POST" action="">id : <input type="hidden" name="id" value="<?PHP echo $row_products['id'];?>"/><?PHP echo $row_products['id'];?><br/>category : <input type="text" name="category" value="<?PHP echo $row_products['category'];?>"/><br/>familyname : <input type="text" name="familyname" value="<?PHP echo $row_products['familyname'];?>"/><br/>family_id : <input type="text" name="family_id" value="<?PHP echo $row_products['family_id'];?>"/><br/>subfamily_identifier : <input type="text" name="subfamily_identifier" value="<?PHP echo $row_products['subfamily_identifier'];?>"/><br/>name : <input type="text" name="name" value="<?PHP echo $row_products['name'];?>"/><br/>description : <input type="text" name="description" value="<?PHP echo $row_products['description'];?>"/><br/>color : <input type="text" name="color" value="<?PHP echo $row_products['color'];?>"/><br/>weight : <input type="text" name="weight" value="<?PHP echo $row_products['weight'];?>"/><br/>list_price : <input type="text" name="list_price" value="<?PHP echo $row_products['list_price'];?>"/><br/>inactive : <input type="text" name="inactive" value="<?PHP echo $row_products['inactive'];?>"/><br/>button : <input type="text" name="button" value="<?PHP echo $row_products['button'];?>"/><br/><input type="reset" name="reset" value="Reset" /><input type="submit" name="update" value="OK" /><br/></form><br/><?PHP }}elseif (isset($_POST['id'])&&isset($_POST['delete'])){$result_products_to_del = mysql_query("SELECT * FROM products WHERE id='".$_POST['id']."'");while($row_products_to_del = mysql_fetch_array($result_products_to_del)){ ?>Do You Want To Delete<form id="delete_products" name="delete_products" method="POST" action="">id : <input type="hidden" name="id" value="<?PHP echo $row_products_to_del['id'];?>"/><?PHP echo $row_products_to_del['id'];?><br/>category :<?PHP echo $row_products_to_del['category'];?><br/>familyname :<?PHP echo $row_products_to_del['familyname'];?><br/>family_id :<?PHP echo $row_products_to_del['family_id'];?><br/>subfamily_identifier :<?PHP echo $row_products_to_del['subfamily_identifier'];?><br/>name :<?PHP echo $row_products_to_del['name'];?><br/>description :<?PHP echo $row_products_to_del['description'];?><br/>color :<?PHP echo $row_products_to_del['color'];?><br/>weight :<?PHP echo $row_products_to_del['weight'];?><br/>list_price :<?PHP echo $row_products_to_del['list_price'];?><br/>inactive :<?PHP echo $row_products_to_del['inactive'];?><br/>button :<?PHP echo $row_products_to_del['button'];?><br/><input type="submit" name="confirm_delete" value="YES" /><input type="button" value="NO" onClick="document.location.href='?'"><br/></form><br/><?PHP }}else{//$sql = "SELECT * FROM products WHERE category='Building Envelope Products' order by id";$sql = "SELECT * FROM products order by id";$result = @mysql_query($sql);/*if (!isset(result)){$error = 'Error fetching information';exit();}*/echo '<table class="building"><tr><caption>Edit Building Envelope Products</caption</tr><tr><th>ID</th><th>CATEGORY</th><th>FAMILY</th><th>FAMILY ID</th><th>SBFM</th><th>NAME</th><th>DESCRIPTION</th><th>COLOR</th><th>WT</th><th>PRICE</th><th>INACT</th><th>PayPal #</th><th>EDIT</th><th>Delete</th></tr>';while ($row = mysql_fetch_array($result)){echo '<form action="" method="post">';echo '<tr><td><input type="text" name="id" value = "' . $row['id'] . '" size="9" /></td>';echo '<td><input type="text" name="category" value = "' . htmlspecialchars($row['category'], ENT_QUOTES, 'UTF-8') . '" size="15" /></td>';echo '<td><input type="text" name="familyname" value = "' . htmlspecialchars($row['familyname'], ENT_QUOTES, 'UTF-8') . '" size="10" /></td>';echo '<td><input type="text" name="family_id" value = "' . htmlspecialchars($row['family_id'], ENT_QUOTES, 'UTF-8') . '" size="10" /></td>';echo '<td><input type="text" name="subfamily_identifier" value = "' . htmlspecialchars($row['subfamily_identifier'], ENT_QUOTES, 'UTF-8') . '" size="5" /></td>';echo '<td><input type="text" name="name" value = "' . htmlspecialchars($row['name'], ENT_QUOTES, 'UTF-8') . '" size="15" /></td>';echo '<td><input type="text" name="description" value = "' . htmlspecialchars($row['description'], ENT_QUOTES, 'UTF-8') . '" size="45" /></td>';echo '<td><input type="text" name="color" value = "' . htmlspecialchars($row['color'], ENT_QUOTES, 'UTF-8') . '" size="5" /></td>';echo '<td><input type="text" name="weight" value = "' . htmlspecialchars($row['weight'], ENT_QUOTES, 'UTF-8') . '" size="3" /></td>';echo '<td><input type="text" name="list_price" value = "' . htmlspecialchars($row['list_price'], ENT_QUOTES, 'UTF-8') . '" size="3" /></td>';echo '<td><input type="text" name="inactive" value = "' . htmlspecialchars($row['inactive'], ENT_QUOTES, 'UTF-8') . '" size="1" /></td>';echo '<td><input type="text" name="button" value = "' . htmlspecialchars($row['button'], ENT_QUOTES, 'UTF-8') . '" size="15" /></td>';echo '<td><input type="submit" name="edit" value="Edit" /></td>';echo '<td><input type="submit" name="delete" value="Delete" /></td>';echo '</form>';}echo '</table>';}
  16. may move *show cart* section into function and... function showcart(){echo "<H1>my cart<H1>";//Move show cart section to here}if (isset($_GET["show_price"])&&$_GET["show_price"]=="yes"){showcart();}
  17. i can't see where those variable com from.$homepage,$login_page,$signup_pag,$account_page may need define.
  18. action POST safe and securitybut GET from URL powerfull for one script file if your need more action-----------------------------------------------------------------------------------------------I'm from Thailand Ser.
  19. that's GET Action from URLhttp://www.w3schools.com/php/php_get.asp
  20. change<form name="contactform" method="POST"to<form name="contactform" method="GET" and check value from URL after submited after code complete change to POST again
  21. some of problem $_SESSION["session_name"];// <---- THIS WORK$_SESSION['session_name'];// <---- THIS WORK$_session["session_name"];// <---- this not work$_session[session_name];// <---- this not work$_SESSION[session_name];// <---- this not work $_POST["var"];// <----THIS WORK$_POST['var'];// <----THIS WORK$_POST[var];// <---- this not work$_post["var"];// <---- this not work $_GET["var"];// <---- THIS WORK$_GET['var'];// <---- THIS WORK$_GET[var];// <---- this not work$_get["var"];// <---- this not work
  22. if session not workmove <?PHPsession_start(); to first of fileand encode to utf8 without BOM(I use notepad++ to do this in menu encoding)
  23. can use more than one button submit like delete button on content_product.php in one formsample <form id="form1" name="form1" method="POST" action=""> <label> <input type="submit" name="a" value="a" /> </label> <input type="submit" name="b" value="b" /> <input type="submit" name="c" value="c" /></form><?PHPif (isset($_POST['a'])) { echo 'action=a';}if (isset($_POST['b'])) { echo 'action=b';}if (isset($_POST['c'])) {echo 'action=c';//include('tets.php');}?>
  24. may use...action= "content_product.php" then ....in "content_product.php" check if $_POST['submit'] include('basket.php')
×
×
  • Create New...