Hi! I have tryed do it from examples, but without succes. So my problem is - i have form where can change settings, but i have problem i need scripy wich will not insert into database new numbers or laters, but update(change) them. I have found some examples but i after few hours tryed give up to get it work. So i came to you with ask to help. Examples i delete so its just form. ohh.. in some places its in Latvian lang if you need know what is it, ask ;) Ohh.. if in the script has some of mistakes or somthink like that please say to me ;) I hope you understand me :)

<this is page.php file>

include ("config/web_config.php");
include ("config/user_config.php");
$link = mysql_connect('localhost', 'root', 'cakste');
if (!$link) {
    die('Could not connect: ' . mysql_error());
if (!mysql_select_db('dem')) {
    die('Could not select database: ' . mysql_error());
$title = mysql_query('SELECT title FROM pageconfig');
if (!$title) {
    die('Could not query:' . mysql_error());

<title><?php echo $lang['PAGE_TITLE']; ?></title>
body {
margin-left: <?php echo $lang['STYLE_BML']; ?>;
margin-right: <?php echo $lang['STYLE_BMR']; ?>;

#head {
width: <?php echo $lang['STYLE_HW']; ?>;
height: <?php echo $lang['STYLE_HH']; ?>;
background-color: <?php echo $lang['STYLE_HBC']; ?>;


#menu {
width: <?php echo $lang['STYLE_MW']; ?>;
height: <?php echo $lang['STYLE_MH']; ?>;
background-color: <?php echo $lang['STYLE_MBC']; ?>;

#content {
border: <?php echo $lang['STYLE_CB']; ?>;
width: <?php echo $lang['STYLE_CW']; ?>;
height: <?php echo $lang['STYLE_CH']; ?>;
background-color: <?php echo $lang['STYLE_CBC']; ?>;

#heading {
padding-top: 20px;


#cont {
padding-left: 60px;
margin-left: 90px;
margin-right: 90px;
padding-top: 20px;
border: 2px;
height: 260px;
border-color: #000000;
background-color: #C0C0C0;
background-image: url('images/bg.png');

    width: 100%;
    background-color: #333; }
.menu ul{
    margin: 0; padding: 0;
    float: left;}
.menu ul li{
    display: inline;}
.menu ul li a{
    float: left; text-decoration: none;
    color: white;
    padding: 10.5px 11px;
    background-color: #333; }
.menu ul li a:visited{
    color: white;}
.menu ul li a:hover, .menu ul li .current{
    color: #fff;
<body bgcolor="<?php echo $lang['STYLE_BGCOLOR']; ?>">
<div id="head"><img src="<?php echo $lang['STYLE_LOGO']; ?>" /></div>
<div id="menu" name="Izvelne">
<div class="menu">
<ul id="tablist">
<li><a href="<?php echo $lang['LINK_1']; ?>"><?php echo $lang['MENU_1']; ?></a></li>
<li><a href="<?php echo $lang['LINK_2']; ?>"><?php echo $lang['MENU_2']; ?></a></li>
<li><a href="<?php echo $lang['LINK_3']; ?>"><?php echo $lang['MENU_3']; ?></a></li>
<li><a href="<?php echo $lang['LINK_4']; ?>"><?php echo $lang['MENU_4']; ?></a></li>
<li><a href="<?php echo $lang['LINK_5']; ?>"><?php echo $lang['MENU_5']; ?></a></li>
<li><a href="<?php echo $lang['LINK_6']; ?>"><?php echo $lang['MENU_6']; ?></a></li>
<div id="content" name="Matreals">
<div id="heading" name="heading">
<table border="0" bgcolor="#888888" width="80%">

<div id="cont" border="1">
<form action="insert-page.php" method="post">
<label><b>Lapas nosaukums (virsraksts) : </b></label><input name="title" type="box" size="16" value="<?php echo mysql_result($title,0); ?>" /><label><b> Piemeram : Youtube - video for you!</b></label> <br />
<br />
<br />
<center><input type="submit" value="Saglabāt"></center>
<br />
<br />
<?php   ?>

This is action page called insert-page.php

$con = mysql_connect("localhost","root","cakste");
if (!$con)
  die('Could not connect: ' . mysql_error());

mysql_select_db("dem", $con);

$sql="INSERT INTO pageconfig (title)

if (!mysql_query($sql,$con))
  die('Error: ' . mysql_error());
echo "1 record added";


If you need somthink else let me know ;)

Recommended Answers

All 2 Replies

sorry but can't understand the problem??

Can you explain the problem clearly??


class httppost {
    public $value;
    function stripslashes($value) {
        $value = is_array($value) ? array_map(array($this,'stripslashes'), $value) : stripslashes($value);
        return $value;
    function __construct($in) {
    if(get_magic_quotes_gpc()) {
        //magic quotes enabled
        } else {

$post=new httppost($_POST);

$sql='INSERT INTO pageconfig (title) VALUES ("'.mysql_real_escape_string($post->value['title']).'")';
mysql_query($sql) or die('Error: '.mysql_error().'<hr>'.htmlentities($sql));

echo '1 record added';

And the last line of the other page can be deleted as it does nothing (line 135)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.