Jump to content

faces3

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by faces3

  1. Yes I try it but give same error. http://workhour.tk/silmaring/regkool/
  2. Undefined index: $item_id ajax.php on line 8
  3. Error invalid JSON: and give ajax.php file
  4. That script i get that site. http://www.amitpatil.me/ajax-table-adding-removing-rows-dynamically-using-javascript-animation/ Seems there is more people who cant get work it.
  5. Here is my database. -- phpMyAdmin SQL Dump -- version 3.5.4 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: May 01, 2013 at 10:11 PM -- Server version: 5.1.67 -- PHP Version: 5.3.3 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `silmaring` -- -- -------------------------------------------------------- -- -- Table structure for table `kool` -- CREATE TABLE IF NOT EXISTS `kool` ( `nr` time NOT NULL, `kool` varchar(50) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  6. Looks ['action'] is right. File: script.js $(document).ready(function(){ $("#save").click(function(){ ajax("save"); }); $("#add_new").click(function(){ $(".entry-form").fadeIn("fast"); }); $("#close").click(function(){ $(".entry-form").fadeOut("fast"); }); $("#cancel").click(function(){ $(".entry-form").fadeOut("fast"); }); $(".del").live("click",function(){ ajax("delete",$(this).attr("id")); }); function ajax(action,id){ if(action =="save") data = $("#userinfo").serialize()+"&action="+action; else if(action == "delete"){ data = "action="+action+"&item_id="+id; } $.ajax({ type: "POST", url: "ajax.php", data : data, dataType: "json", success: function(response){ if(response.success == "1"){ if(action == "save"){ $(".entry-form").fadeOut("fast",function(){ $(".table-list").append("<tr><td>"+response.kool+"</td><td><a href='#' id='"+response.row_id+"' class='del'>Delete</a></a></td></tr>"); $(".table-list tr:last").effect("highlight", { color: '#4BADF5' }, 1000); }); }else if(action == "delete"){ var row_id = response.item_id; $("a[id='"+row_id+"']").closest("tr").effect("highlight", { color: '#4BADF5' }, 1000); $("a[id='"+row_id+"']").closest("tr").fadeOut(); } }else{ alert(response.msg); } }, error: function(res){ alert("Unexpected error! Try again."); } }); } }); Website give me same error what is here... "Unexpected error! Try again."
  7. I add that is it right? I dont see errors... error_reporting(E_ALL); ini_set('display_errors', '1'); And i add that line: $action = $_POST['action']; But seems it dont work. What i must put there ['action'] Or is it right?
  8. I try get work that script, but something is wrong... Cant save new values and cant delete values. <html> <head> <title>Silmaring</title> <script src="js/jquery.js"></script> <script src="js/script.js"></script> <script src="js/jquery-ui-1.8.17.custom.min.js"></script> <link rel="stylesheet" href="css/style.css"> </head> <body> <br> <div style="margin-left: 20%;margin-top: 5%;"> <input type="button" value="Lisa" id="add_new"><p> <table width="70%" border="0" cellpadding="0" cellspacing="0" class="table-list"> <tr> <th width="20%">Kooli nimi</th> <th width="40%">Kustuta</th> </tr> </table> </div> <div class="entry-form"> <form name="userinfo" id="userinfo"> <table width="100%" border="0" cellpadding="4" cellspacing="0"> <tr> <td colspan="2" align="right"><a href="#" id="close">Sulge</a></td> </tr> <tr> <td>Kooli nimi</td> <td><input type="text" name="kool"></td> </tr> <tr> <td align="right"></td> <td><input type="button" value="Salvesta" id="save"><input type="button" value="Tühista" id="cancel"></td> </tr> </table> </form> </div> </body> </html> And here is ajax.php file. <? ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(-1); $conn = mysql_connect("localhost","root","") or die(mysql_error()); mysql_select_db("silmaring",$conn) or die(mysql_error()); if(isset($_POST) && count($_POST)){ $kool = $_POST['kool']; $item_id = $_POST['$item_id']; if($action == "save"){ $res = mysql_query("insert into kool values('','".$kool."')"); if($res){ echo json_encode( array( "success" => "1", "row_id" => time(), "kool" => htmlentities($kool), ) ); } } else if($action == "delete"){ $res = mysql_query("delete from info where id = $"); if($res){ echo json_encode( array( "success" => "1", "item_id" => $item_id ) ); } } }else{ echo "No data set"; } ?> I turn error messages on, but dont see any errors.
  9. <code><html xmlns="http://www.w3.org/1999/xhtml"><head profile="http://gmpg.org/xfn/11"> <head> <title>Dynamically Add Remove Textboxes Using Jquery</title> <script type="text/javascript" src="jquery-1.5.2.min.js"></script> <script src="jquery-ui.min.js"></script> <style type="text/css"> body{ font-family:arial; color:#666; } form input{ border:2px solid #dadada; border-radius:7px; font-size:20px; padding:5px; width:250px; } input:focus { outline:none; border-color:#9ecaed; box-shadow:0 0 10px #9ecaed; } form .button{ background: -moz-linear-gradient(top, #00b7ea 21%, #009ec3 76%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(21%,#00b7ea), color-stop(76%,#009ec3)); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, #00b7ea 21%,#009ec3 76%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, #00b7ea 21%,#009ec3 76%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, #00b7ea 21%,#009ec3 76%); /* IE10+ */ background: linear-gradient(to bottom, #00b7ea 21%,#009ec3 76%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00b7ea', endColorstr='#009ec3',GradientType=0 ); /* IE6-9 */ color:#DFE9EC; border:none; cursor:pointer; padding:7px; } .txt_div{ float:left; width:300px; margin-bottom:10px; } .left{ float:left; width:250px; } .right{ float:right; width:40px; padding-top: 11px; } img{ cursor:pointer; } </style> <script type="text/javascript"> $(document).ready(function(){ var id = 2,max = 8,append_data; /*If the add icon was clicked*/ $(".add").live('click',function(){ if($("div[id^=txt_]").length <{ //Don't add new textbox if max limit exceed $(this).remove(); //remove the add icon from current text box var append_data = '<div id="txt_'+id+'" class="txt_div" style="display:none;"><div class="left"><input type="text" id="input_'+id+'" name="txtval[]"/></div><div class="right"><img src="add.png" class="add"/> <img src="remove.png" class="remove"/></div></div>'; $("#text_boxes").append(append_data); //append new text box in main div $("#txt_"+id).effect("bounce", { times:3 }, 300); //display block appended text box with silde down id++; } else { alert("Maximum 8 textboxes are allowed"); } }) /*If remove icon was clicked*/ $(".remove").live('click',function(){ var prev_obj = $(this).parents().eq(1).prev().attr('id'); //previous div id of this text box $(this).parents().eq(1).slideUp('medium',function() { $(this).remove(); //remove this text box with slide up if($("div[id^=txt_]").length > 1){ append_data = '<img src="remove.png" class="remove"/>'; //Add remove icon if number of text boxes are greater than 1 }else{ append_data = ''; } if($(".add").length < 1){ $("#"+prev_obj+" .right").html('<img src="add.png" class="add"/> '+append_data); } }); }) }); </script> </head> <body> <div style="width:800px; margin:auto;padding-top:100px;"> <h1>Dynamically Add Remove Textboxes Using Jquery</h1> <form id="form" name="form"> <div id="text_boxes" style="width:300px;height:auto;"> <div id="txt_1" class="txt_div"> <div class="left"> <input type="text" id="input_1" name="txtval[]"/> </div> <div class="right"> <img src="add.png" class="add"/> </div> </div> </div> <div style="clear:left;"></div> <input type="button" value="SUBMIT" class="button" onclick="javascript:alert($('#form').serialize());"> </form> </div> </body> </html></code>
  10. http://demo.blogaddition.com/dynamic_textbox/
  11. How add one more input value and save same row database two values. Like this: Name: [Textbox1] Values: [Textbox2][textbox2] [add new] [submit] Create new table in database and table name is "Textbox1" values. And save that new table one row "textbox2" and "textbox3" values. Here is code link how must it look like:) Thanks for help!
  12. http://demo.blogaddition.com/dynamic_textbox/
  13. Just like here, but open two input fields and how to save it database new row.
  14. I need have only one line input field. and have button "add new input line in form" And then open new line and there is two input field. And all input field line save new row in database.
  15. Hey! I work for add/remove input field and mysql. But im newbie and little bit problems with it. I want all field data save new row. Here is script. <html> <head> <title>Silmaring</title> <meta name="description" content="Silmaring"> <meta name="author" content="Silmaring"> <STYLE type="text/css"> #ained { position:absolute; margin-top:40px; } #ope { position:absolute; margin-top:40px; margin-left:200px; } #lisa { position:absolute; margin-top:500px; } </STYLE> </head> <body> <form action= "" method="post" enctype="multipart/form-data"> <H2>Registeeri uus kool</h2> Koolinimi: <input type="text" name = "kool" size="15" /></br> <div id="ained"> Ained:</br> <input type="text" name="aine" id="aine"><br> <input type="text" name="aine" id="aine"><br> </div> <div id="ope"> Õpetajad: <input type="text" name="ope" id="ope"><br> <input type="text" name="ope" id="ope"><br> </div> <div id="lisa"> </br><input type="submit" value="Lisa kool" /> </div> </form> </body> </html> <?php error_reporting(E_ALL ^ E_NOTICE); $kool = $_REQUEST['kool']; $aine = $_REQUEST['aine']; $ope = $_REQUEST['ope']; // MySQL uhendus $user="root"; $password=""; $database="silmaring"; $con="localhost"; mysql_connect($con,$user,$password); @mysql_select_db($database) or die( "Unable to select database"); mysql_query("CREATE TABLE $kool(id int(6) NOT NULL auto_increment,aine varchar(50) NOT NULL,opetaja varchar(50) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))"); mysql_query("INSERT INTO $kool(aine,opetaja) VALUES ('$ope','$ope')"); mysql_query("INSERT INTO $kool(aine,opetaja) VALUES ('$ope','$ope')"); mysql_close(); ?>
  16. <html> <head> <title>Uue firma loomine</title> <meta name="description" content="Uue firma loomine"> <meta name="author" content="uus"> </head> <body> <form action= "" method="post"> <H2>Firma:</h2> Firma nimi: <input type="text" name = "fnimi" size="30" /></br> Firma registrikood: <input type="text" name = "reg" size="30" /></br> Telefoni number: <input type="text" name = "ftel" size="30" /></br> Emaili aadress: <input type="text" name = "femail" size="30" /></br> Koduleht: <input type="text" name = "www" size="30" /></br> <H2>Admin:</H2> Ees- ja perekonnanimi: <input type="text" name = "animi" size="30" /></br> Telefoni numer: <input type="text" name = "atel" size="30" /></br> Emaili aadress: <input type="text" name = "aemail" size="30" /></br> Kasutajanimi: <input type="text" name = "akas" size="30" /></br> Parool: <input type="text" name = "apwd" size="30" /></br> <H2>Raamatupidaja:</H2> Ees- ja perekonnanimi: <input type="text" name = "rnimi" size="30" /></br> Telefoni numer: <input type="text" name = "rtel" size="30" /></br> Emaili aadress: <input type="text" name = "remail" size="30" /></br> Kasutajanimi: <input type="text" name = "rkas" size="30" /></br> Parool: <input type="text" name = "rpwd" size="30" /></br> <h2>Töödejuhataja</h2> Ees- ja perekonnanimi: <input type="text" name = "jnimi" size="30" /></br> Telefoni numer: <input type="text" name = "jtel" size="30" /></br> Emaili aadress: <input type="text" name = "jemail" size="30" /></br> Kasutajanimi: <input type="text" name = "jkas" size="30" /></br> Parool: <input type="text" name = "jpwd" size="30" /></br> <h2>Tööline</h2> Ees- ja perekonnanimi: <input type="text" name = "jnimi" size="30" /></br> Telefoni numer: <input type="text" name = "jtel" size="30" /></br> Emaili aadress: <input type="text" name = "jemail" size="30" /></br> Kasutajanimi: <input type="text" name = "jkas" size="30" /></br> Parool: <input type="text" name = "jpwd" size="30" /></br> <h2>Uldine</h2> Sisselogimis aadress: <input type="text" name = "sub" size="30" /></br> <input type="submit" value="Add" /> </form> </body> </html> <?php // Firma andmed $fnimi = $_REQUEST['fnimi']; $reg = $_REQUEST['reg']; $ftel = $_REQUEST['ftel']; $femail = $_REQUEST['femail']; $www = $_REQUEST['www']; // Aladomeen/andmebaas/kaust $sub = $_REQUEST['sub']; // MySQL uhendus $user="root"; $password=""; $database="firma"; $con="localhost"; mysql_connect($con,$user,$password); @mysql_select_db($database) or die( "Unable to select database"); mysql_query("CREATE TABLE $sub(id int(6) NOT NULL auto_increment,firma_nimi varchar(50) NOT NULL,firma_reg varchar(50) NOT NULL,firma_telefon varchar(50) NOT NULL,firma_email varchar(50) NOT NULL,firma_www varchar(50) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))"); mysql_query("INSERT INTO $sub(firma_nimi, firma_reg, firma_telefon, firma_email, firma_www) VALUES ('$fnimi', 'reg', '$ftel', '$femail', '$fwww')"); mysql_close(); ?> <?php $folder = $_REQUEST['sub']; if(is_dir($folder)) echo "See kataloog on juba olemas!"; else { $zip = new ZipArchive; $res = $zip->open('w.zip'); if ($res === TRUE) { $zip->extractTo($folder); $zip->close(); } } ?> <?php $con=mysqli_connect("localhost","root",""); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // Create database if(isset($_POST['sub'])){ $andmebaas = $_POST['sub']; $sql="CREATE DATABASE $andmebaas"; if (mysqli_query($con,$sql)) { echo "Database my_db created successfully"; } else { echo "Error creating database: " . mysqli_error($con); } } ?> <?php ini_set('error_reporting', E_ALL); // Firma andmed $fnimi = $_REQUEST['fnimi']; $reg = $_REQUEST['reg']; $ftel = $_REQUEST['ftel']; $femail = $_REQUEST['femail']; $www = $_REQUEST['www']; // MySQL uhendus $user="root"; $password=""; if ( isset($_REQUEST['sub']) ) { $database = $_REQUEST['sub']; } $con="localhost"; mysql_connect($con,$user,$password); @mysql_select_db($database) or die( "Unable to select database"); // Firma tabeli tegemine mysql_query("CREATE TABLE firma(id int(6) NOT NULL auto_increment,firma_nimi varchar(50) NOT NULL,firma_reg varchar(50) NOT NULL,firma_telefon varchar(50) NOT NULL,firma_email varchar(50) NOT NULL,firma_www varchar(50) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))"); // Firma andmete sisestamine mysql_query("INSERT INTO firma(firma_nimi, firma_reg, firma_telefon, firma_email, firma_www) VALUES ('$fnimi', '$reg', '$ftel', '$femail', '$fwww')"); mysql_close(); ?> <?php ini_set('error_reporting', E_ALL); // Admini andmed $animi = $_REQUEST['animi']; $atel = $_REQUEST['atel']; $aemail = $_REQUEST['aemail']; $akas = $_REQUEST['akas']; $apwd = $_REQUEST['apwd']; // MySQL uhendus $user="root"; $password=""; if ( isset($_REQUEST['sub']) ) { $database = $_REQUEST['sub']; } $con="localhost"; mysql_connect($con,$user,$password); @mysql_select_db($database) or die( "Unable to select database"); // Admin tabeli tegemine mysql_query("CREATE TABLE admin(id int(6) NOT NULL auto_increment,nimi varchar(50) NOT NULL,telefon varchar(50) NOT NULL,email varchar(50) NOT NULL,kasutaja varchar(50) NOT NULL,parool varchar(50) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))"); // Admin andmete sisestamine mysql_query("INSERT INTO admin(admin_nimi, admin_telefon, admin_email, admin_kasutaja, admin_parool) VALUES ('$animi', '$atel', '$aemail', '$akas', '$apwd')"); mysql_close(); ?> <?php ini_set('error_reporting', E_ALL); // Raamatupidaja andmed $animi = $_REQUEST['rnimi']; $atel = $_REQUEST['rtel']; $aemail = $_REQUEST['remail']; $akas = $_REQUEST['rkas']; $apwd = $_REQUEST['rpwd']; // MySQL uhendus $user="root"; $password=""; if ( isset($_REQUEST['sub']) ) { $database = $_REQUEST['sub']; } $con="localhost"; mysql_connect($con,$user,$password); @mysql_select_db($database) or die( "Unable to select database"); // Raamatupidaja andmete sisestamine mysql_query("INSERT INTO admin(raamatupidaja_nimi, raamatupidaja_telefon, raamatupidaja_email, raamatupidaja_kasutaja, raamatupidaja_parool) VALUES ('$rnimi', '$rtel', '$remail', '$rkas', '$rpwd')"); mysql_close(); ?> <?php ini_set('error_reporting', E_ALL); // Töödejuhataja andmed $animi = $_REQUEST['jnimi']; $atel = $_REQUEST['jtel']; $aemail = $_REQUEST['jemail']; $akas = $_REQUEST['jkas']; $apwd = $_REQUEST['jpwd']; // MySQL uhendus $user="root"; $password=""; if ( isset($_REQUEST['sub']) ) { $database = $_REQUEST['sub']; } $con="localhost"; mysql_connect($con,$user,$password); @mysql_select_db($database) or die( "Unable to select database"); // Juhataja tabeli tegemine mysql_query("CREATE TABLE juhataja(id int(6) NOT NULL auto_increment,nimi varchar(50) NOT NULL,telefon varchar(50) NOT NULL,email varchar(50) NOT NULL,kasutaja varchar(50) NOT NULL,parool varchar(50) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))"); // Juhataja andmete sisestamine mysql_query("INSERT INTO juhataja(juhataja_nimi, juhataja_telefon, juhataja_email, juhataja_kasutaja, juhataja_parool) VALUES ('$jnimi', '$jtel', '$jemail', '$jkas', '$jpwd')"); mysql_close(); ?> <?php ini_set('error_reporting', E_ALL); // Töölise andmed $animi = $_REQUEST['tnimi']; $atel = $_REQUEST['ttel']; $aemail = $_REQUEST['temail']; $akas = $_REQUEST['tkas']; $apwd = $_REQUEST['tpwd']; // MySQL uhendus $user="root"; $password=""; if ( isset($_REQUEST['sub']) ) { $database = $_REQUEST['sub']; } $con="localhost"; mysql_connect($con,$user,$password); @mysql_select_db($database) or die( "Unable to select database"); // Töölise tabeli tegemine mysql_query("CREATE TABLE tooline(id int(6) NOT NULL auto_increment,nimi varchar(50) NOT NULL,telefon varchar(50) NOT NULL,email varchar(50) NOT NULL,kasutaja varchar(50) NOT NULL,parool varchar(50) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))"); // Töölise andmete sisestamine mysql_query("INSERT INTO tooline(toolise_nimi, toolise_telefon, toolise_email, toolise_kasutaja, toolise_parool) VALUES ('$tnimi', '$ttel', '$temail', '$tkas', '$tpwd')"); mysql_close(); ?> In that script add only database: // Firma andmete sisestamine mysql_query("INSERT INTO firma(firma_nimi, firma_reg, firma_telefon, firma_email, firma_www) VALUES ('$fnimi', '$reg', '$ftel', '$femail', '$fwww')"); mysql_close(); ?> How fix it?
  17. Hey! I try and try create validate to that script, but dont work... <form action= "" method="post"> Mysql tabel: <input type="text" name = "tabel" size="30" /></br> Firma nimi:<input type="text" name = "firma" size="30" /></br> Telefon:<input type="text" name = "telefon" size="30" /></br> Email:<input type="text" name = "email" size="30" /></br> Kontakt:<input type="text" name = "kontakt" size="30" /></br> <input type="submit" value="Add" /> </form> <?php $tabel = $_REQUEST['tabel']; $firma = $_REQUEST['firma']; $tel = $_REQUEST['telefon']; $email = $_REQUEST['email']; $kontakt = $_REQUEST['kontakt']; $user="root"; $password=""; $database="firma"; $con="localhost"; mysql_connect($con,$user,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="CREATE TABLE $tabel(id int(6) NOT NULL auto_increment,firma varchar(50) NOT NULL,telefon varchar(50) NOT NULL,email varchar(50) NOT NULL,kontakt varchar(50) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))"; mysql_query($query); $qu="INSERT INTO $tabel(firma, telefon, email, kontakt) VALUES ('$firma', '$tel', '$email', '$kontakt')"; mysql_query($qu); mysql_close(); ?> <?php $folder = $_REQUEST['tabel']; if(is_dir($folder)) echo "See kataloog on juba olemas!"; else { $zip = new ZipArchive; $res = $zip->open('w.zip'); if ($res === TRUE) { $zip->extractTo($folder); $zip->close(); echo 'Kaust loodud ja failid lahti pakitud!'; } else { echo 'Viga lahtipakkimisel!'; } } ?> <?php error_reporting(E_ALL); ini_set('display_errors', 1); $con=mysqli_connect("localhost","root",""); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // Create database if(isset($_POST['tabel'])){ $andmebaas = $_POST['tabel']; $sql="CREATE DATABASE $andmebaas"; if (mysqli_query($con,$sql)) { echo "Database my_db created successfully"; } else { echo "Error creating database: " . mysqli_error($con); } } ?> One thing more... i want get form name and create subdomain. I dont use cpanel. I use zpanel. I find and find google script but dont seem... all scripts is to cpanel. Someone know where i can get subdomain php script?
  18. Problem with get data form and add database. Its all in same page. <form action= "" method="post"> <input type="text" name = "database" size="30" /> <input type="text" name = "firma" size="30" /> <input type="text" name = "telefon" size="30" /> <input type="text" name = "email" size="30" /> <input type="text" name = "koduleht" size="30" /> <input type="text" name = "kontakt" size="30" /> <input type="text" name = "aeg" size="30" /> <input type="submit" value="Add" /> </form> <?php $tabel = $_REQUEST['database']; $firma = $_REQUEST['firma']; $tel = $_REQUEST['telefon']; $email = $_REQUEST['email']; $kontakt = $_REQUEST['kontakt']; $con=mysqli_connect("localhost","root","kala", $tabel); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } INSERT INTO $tabel (firma, telefon, email, kontakt) VALUES ('$firma' , '$tel' , '$email' , '$kontakt'); mysqli_close($con); ?>
  19. How display all database in php checkbox / dropdown list where can choose what database connect.
  20. I have one database where is table like "owner", "admin","worker". Now i want checkbox for that form where can choose what user group it save. Have someone idea how to do it? <form method="post" action="#"> Posted By:<br /><input name="postedby" id="postedby" type="Text" size="50" maxlength="50"><br /> Subject:<br /><input name="subject" id="subject" type="Text" size="50" maxlength="50"><br /> <textarea name="news" id="news" cols="50" rows="5"></textarea><br /> <input type="Submit" name="submit" id="submit" value="Enter News"> </form> <?php function clear($message) { if(!get_magic_quotes_gpc()) $message = addslashes($message); $message = strip_tags($message); $message = htmlentities($message); return trim($message); } if ($_POST['submit']) { if (empty($_POST['postedby'])) die('Enter a name.'); else if (empty($_POST['subject'])) die('Enter a subject.'); else if (empty($_POST['news'])) die('Enter an article.'); $postedby = clear($_POST['postedby']); $subject = clear($_POST['subject']); $news = clear($_POST['news']); $date = mktime(); mysql_connect('localhost','username','password'); mysql_select_db('db'); if(mysql_query("INSERT INTO news (id , postedby , news , subject , date) VALUES ('', '$postedby', '$news', '$subject', '$date')")) echo 'News Entered.'; mysql_close(); } ?> I try do it... but its wrong.... Checkboxes: <input type="checkbox" name="worker" id="worker">Send news to worker<br> <input type="checkbox" name="owner" id="owner">Send news to owner<br> Submit: $date = clear ($_POST['owner']); $date = clear ($_POST['worker']); Save to database: if(mysql_query("INSERT INTO news (id , postedby , news , subject , date) VALUES ('', '$postedby', '$news', '$subject', '$date', '$worker', '$owner')"))
  21. File1: <?php $home['1']='home/1.php' $home['2']='home/2.php' ?> File2: <?php Include File1.php <a href="<?php echo $home['1']; ?>">home 1</a> ?> Whats wrong is that simple script? Can someone help me little bit
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.