php Notice: Trying to get property of non-object in - php

I have to recognize that I'm new in php oop, but I want to learn. I searched for the same title here but I didn't see any topic close to mine to get an idea.
I have an function in a events calendar class, that display a form to add an event. Where I have the form I get an error on each line, about the event variable:
Notice: Undefined variable: event in C:\wamp\www
This is the function:
public function displayForm() {
/*
* Check if an ID was passed
*/
if(isset($_POST['event_id'])) {
$id = (int)$_POST['event_id'];
}
else {
$id = NULL;
}
/*
* Instantiate the headline/submit button text
*/
$submit = "Create a New Event";
/*
* If an ID is passed, loads the associated event
*/
$event = NULL;
if(!empty($id)) {
$event = $this->_loadEventById($id);
/*
* If no object is returned, return NULL
*/
if(!is_object($event)) {
return NULL;
}
$submit = "Edit This Event";
}
/*
* Build the markup
*/
return <<<FORM_MARKUP
<form action="assets/inc/process.inc.php" method="post">
<fieldset>
<legend>$submit</legend>
<label for="event_title">Event Title</label>
<input type="text" name="event_title" id="event_title" value="$event->title" />
<label for="event_start">Event Start</label>
<input type="text" name="event_start" id="event_start" value="$event->start" />
<label for="event_end">Event End</label>
<input type="text" name="event_end" id="event_end" value="$event->end" />
<label for="event_description">Event Description</label>
<textarea name="event_description" id="event_description" >$event->description</textarea>
<input type="hidden" name="event_id" value="$event->id" />
<input type="hidden" name="token" value="$_SESSION[token]" />
<input type="hidden" name="action" value="event_edit" />
<input type="hidden" name="event_submit" value="$submit" />
or cancel
</fieldset>
</form>
FORM_MARKUP;
}
If anyone has an idea feel free to tell me. Thank you.

You should make sure all the variables you use in your form markup are defined in all circumstances... So, $event should never be NULL... you should define default values in case no POST it's received or the id it's not found.
Also, $_SESSION should have the parameter with quotation marks and also should be checked before printing!
Here it's the code I propose you to use:
public function displayForm() {
// Initialize vars
$id = NULL;
$token = '';
/*
* Check if an ID was passed
*/
if(isset($_POST['event_id'])) {
$id = (int)$_POST['event_id'];
}
if (isset($_SESSION['token'])) {
$token = $_SESSION['token'];
}
/*
* Instantiate the headline/submit button text
*/
$submit = "Create a New Event";
/*
* If an ID is passed, loads the associated event
*/
if(!empty($id)) {
//$event = $this->_loadEventById($id);
$event = new stdClass();
$event->title = 'title';
$event->start = '1';
$event->end = '1';
$event->id = '1';
$event->description = 'description';
$submit = "Edit This Event";
}
if (empty($id) || !is_object($event)) {
$event = new stdClass();
$event->title = 'default title';
$event->start = 'default start';
$event->end = 'default end';
$event->id = 'default id';
$event->description = 'default description';
}
/*
* Build the markup
*/
return <<<FORM_MARKUP
<form action="assets/inc/process.inc.php" method="post">
<fieldset>
<legend>$submit</legend>
<label for="event_title">Event Title</label>
<input type="text" name="event_title" id="event_title" value="$event->title" />
<label for="event_start">Event Start</label>
<input type="text" name="event_start" id="event_start" value="$event->start" />
<label for="event_end">Event End</label>
<input type="text" name="event_end" id="event_end" value="$event->end" />
<label for="event_description">Event Description</label>
<textarea name="event_description" id="event_description" >$event->description</textarea>
<input type="hidden" name="event_id" value="$event->id" />
<input type="hidden" name="token" value="$token" />
<input type="hidden" name="action" value="event_edit" />
<input type="hidden" name="event_submit" value="$submit" />
or cancel
</fieldset>
</form>
FORM_MARKUP;
}

You set $event = NULL; and you probably pass an empty $id

Related

keeping history of form data using session

I have a form that users can utilize to introduce some data to create a badge. I'm using session so that i can keep like a little history list for the users, and also if they click on one element from that list the data will be sent to the form automatically. My problem is that when i click on one element from the list a new row is inserted containing the same data, and also if i complete the form with identical data that i already have in my list again it creates another line containing the same data that i already have once. Can i do something so that my history list to contain only unique values, basically to not have the same line multiple times.
This is my code for the form:
<form method="get" autocomplete="off">
<h3>Creaza ecuson</h3>
<label>
Nume:<br><input type="text" name="nume" id="nume" required value="<?php echo $search->nume ?>"><br>
Prenume:<br><input type="text" name="prenume" id="prenume" required value="<?php echo $search->prenume ?>"><br>
Sex:<br><div class="autocomplete" style="width:300px;">
<input id="sex" type="text" name="sex" required value="<?php echo $search->sex ?>">
</div><br><br>
Rol:<br><div class="autocomplete" style="width:300px;">
<input id="rol" type="text" name="rol" required value="<?php echo $search->rol ?>">
</div><br><br>
Culoare text:<br><input type="color" name="cul" id="cul" value="<?php echo $search->cul ?>"><br><br>
Font ecuson:<br><div class="autocomplete" style="width:300px;">
<input id="font" type="text" name="font" required value="<?php echo $search->font ?>">
</div><br><br>
Format ecuson (portrait or landscape):<br><div class="autocomplete" style="width:300px;">
<input id="format" type="text" name="format" required value="<?php echo $search->format ?>">
</div><br><br>
</label>
<input type="submit" name="history" value="History" />
<button type="button" onclick="create()">Creaza</button><br><br>
</form>
My session code:
<?php
session_start();
$search = parseRequest();
storeSearch($search);
include "form.php";
$searches = $_SESSION['searches'];
function storeSearch($search) {
if (!isset($_SESSION['searches'])) {
$_SESSION['searches'] = [];
}
if (!$search->isEmpty()) {
$_SESSION['searches'][] = $search;
}
}
function parseRequest() {
$search = new SearchRequest;
$search->nume = !empty($_GET['nume']) ? $_GET['nume'] : "";
$search->prenume = !empty($_GET['prenume']) ? $_GET['prenume'] : "";
$search->sex = !empty($_GET['sex']) ? $_GET['sex'] : "";
$search->rol = !empty($_GET['rol']) ? $_GET['rol'] : "";
$search->cul = !empty($_GET['cul']) ? $_GET['cul'] : "";
$search->font = !empty($_GET['font']) ? $_GET['font'] : "";
$search->format = !empty($_GET['format']) ? $_GET['format'] : "";
return $search;
}
/**
* search request
*/
class SearchRequest
{
public $nume = "";
public $prenume = "";
public $sex = "";
public $rol = "";
public $cul = "";
public $font = "";
public $format = "";
function toQueryString() {
$params = [
'nume' => $this->nume,
'prenume' => $this->prenume,
'sex' => $this->sex,
'rol'=> $this->rol,
'cul'=> $this->cul,
'font'=> $this->font,
'format'=> $this->format
];
return http_build_query($params);
}
function isEmpty() {
return !$this->nume || !$this->prenume || !$this->sex || !$this->rol || !$this->cul || !$this->font || !$this->format;
}
}
?>
And the so called history code:
<?php
foreach ($searches as $s) {
?>
<li><a href="creare.php?<?php echo $s->toQueryString() ?>">
<?php echo $s->nume?> - <?php echo $s->prenume?> - <?php echo $s->sex?> - <?php echo $s->rol?> - <?php echo $s->cul?> - <?php echo $s->font?> - <?php echo $s->format?>
</a></li>
<?php
}
?>
I don't think the script with the autocomplete function needs to be posted here for the question that i asked. If needed i will provide.
perhaps something as simple as
function storeSearch($search) {
if (!isset($_SESSION['searches'])) {
$_SESSION['searches'] = [];
}
if (!$search->isEmpty() && !in_array($search,$_SESSION['searches') {
$_SESSION['searches'][] = $search;
}
}
Building on CFP Support's answer, here's a slightly different approach to how I would create the form and handler. It's very similar to yours but I structured the logic a bit differently. I only added 3 fields from your form but you can easily add the remaining fields.
Fiddle - http://phpfiddle.org/lite/code/354t-6sgn
<?php
session_start();
// Initialize the cart if it needs it.
if (!isset($_SESSION['cart'])) {
$_SESSION['cart'] = [];
}
// Should we show cart?
$showCart = isset($_GET['cart']) && $_GET['cart'] === 'true';
// Should we clear the cart?
if (isset($_GET['clear']) && $_GET['clear'] === 'true') {
$_SESSION['cart'] = [];
}
// Grab the current cart.
$cart = $_SESSION['cart'];
// The form was submitted
if (isset($_POST['submit'])) {
// Copy the POST data into a variable so we can modify it without side effects.
$formData = $_POST;
// Remove the submit button from the form data
unset($formData['submit']);
// Check if it is in the cart already.
if (!in_array($formData, $cart)) {
// If not, then add it.
$cart[] = $formData;
}
// Store the cart in the session.
$_SESSION['cart'] = $cart;
}
?>
<html>
<head>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
</head>
<body>
<div class="container">
<form method="post" autocomplete="off">
<h3>Creaza ecuson</h3>
<div class="mb-3">
<div class="col-md-6 mb-3">
<label for="nume">Nume:
<input type="text" name="nume" id="nume" class="form-control" required>
</label>
</div>
</div>
<div class="mb-3">
<div class="col-md-6 mb-3">
<label for="prenume">Prenume:
<input type="text" name="prenume" id="prenume" class="form-control" required>
</label>
</div>
</div>
<div class="mb-3">
<div class="col-md-6 mb-3">
<label for="sex">Sex:
<input type="text" name="sex" id="sex" class="form-control" required>
</label>
</div>
</div>
<button class="btn btn-primary" name="submit" type="submit">Create</button>
<?php
// Toggle show/hide history
if ($showCart) { ?>
<a class="btn btn-primary" href="?" role="button">Hide Cart</a>
<?php } else { ?>
<a class="btn btn-primary" href="?cart=true" role="button">Show Cart</a>
<?php }
// If the cart is not empty, allow user to clear it.
if (!empty($cart)) { ?>
<a class="btn btn-primary" href="?clear=true" role="button">Clear Cart</a>
<?php }
?>
</form>
<?php
// Show the cart.
if ($showCart) {
echo '<pre>';
var_dump($cart);
echo '</pre>';
}
?>
</div>
</body>
</html>
Here's a way and little pseudo-code, you could implement something similar with your codebase.
The idea is, since from one computer only one person can sign up, store a unique ID for that person in session. Then when entering the data into session, check if that ID is present or not.
If it's present, do not add, if it's not, add.
Pseudo-code
$uniqueID = hash("sha256", $_SERVER['REMOTE_ADDR']); //generate a unique ID depending on IP since that would be unique for each computer
//insert into your session
if(!in($sessionHandler, $uniqueid)
{
//insert now
}

Not inserting null values

I am trying to insert multiple values in the todo input of the form. but if i do not input a value to any input the null value is inserted in the database. This is my controller action:
public function actionAdd()
{
if (Yii::$app->request->isAjax) {
$request = Yii::$app->request;
$add = new Project();
$add->project_name = $request->post('project');
$add->deadline = $request->post('deadline');
$add->profile_id = $request->post('profile_id');
$add->project_status = "Running";
$add->save();
$getlast = Yii::$app->db->getLastInsertId();
$todo = $request->post('todo');
if (isset($todo)) {
foreach ($todo as $to) {
$add = new Todo();
$add->todo_name=$to;
$add->status="Running";
$add->project_id=$getlast;
$add->save();
}
}
echo json_encode(TRUE); die;
}
echo json_encode(FALSE);die;
}
the form is:
<form class="formclass" method="POST" action="<?php echo Yii::$app->request->baseUrl;?>/todo/add/" role="form" id="register-form" novalidate="novalidate">
<label> Project Name: </label> <input type="name" name="project" class="form-control" placeholder="Project Name" required><br><br>
<input type="hidden" name="profile_id" value="<?php echo $profile_id;?>">
<label> Todo: </label><br>
<textarea type="text" name="todo[]" placeholder="Todo Description..."></textarea>
<div id="dynamicInput">
<span class="glyphicon glyphicon-plus" onClick="addInput('dynamicInput');"></span>
</div><br>
<label> Project Deadline:</label><br>
<input type="date" name="deadline"><br><br>
<button type="submit" class="btn btn-default">Add Project</button><BR><BR>
</form>
And the jquery is:
var counter = 1;
var limit = 10;
function addInput(divName)
{
if (counter != limit)
{
var newdiv = document.createElement('div');
newdiv.innerHTML = "<br><textarea type='text' name='todo[]' placeholder='Todo Description...'></textarea>";
document.getElementById(divName).appendChild(newdiv);
counter++;
}
}
Could be you problem is related to the validation rules ..
for check this and only for debugging try use $add->savel(false)
$add = new Todo();
$add->todo_name=$to;
$add->status="Running";
$add->project_id=$getlast;
$add->save(false);
if in this case the rows are inserted the check for validations rule (eventually comment temporary) .. for find the wrong rules or condition

Class variables NULL?

I am working on a web back-end that will pull information into a form, and then when updated, will update the database with the new information. However, when I try to pull information previously stored in a class private variable, it throws me an error stating that the information is NULL. What am I doing wrong here?
<?php
class modify_racer
{
private $mysqli, $racer_id, $firstname,
$lastname, $banner, $bio;
public function error($code)
{
switch($code)
{
case 1:
echo '<p id="error"><b>Error:</b> Please fill out all fields!</p>';
modify_racer::send_form($this->firstname, $this->lastname, $this->banner, $this->bio);
break;
case 2:
echo '<p id="error"><b>Error:</b> Racer already exists!</p>';
break;
case 3:
echo '<p id="error"><b>Error:</b> Could not connect to MySQLi: ' . mysqli_error();
break;
}
}
public function send_form($modify = 1)
{
?>
<div id="form">
<h3>Edit Racer:</h3>
<form method="post" action="">
<label for="firstname">First Name: </label>
<input type="text" id="firstname" name="firstname"
placeholder="Racer's First Name"
value="<?php echo $this->firstname;?>" />
<br />
<label for="lastname">Last Name: </label>
<input type="text" id="lastname" name="lastname"
placeholder="Racer's Last Name"
value="<?php echo $this->lastname;?>" />
<br />
<label for="banner">Banner Location: </label>
<input type="text" id="banner" name="banner"
placeholder="Racer's Banner Image Location:"
value="<?php echo $this->banner;?>" />
<br />
<label for="bio">Racer's Bio Info: </label>
<textarea rows="5" cols="50" id="bio" name="bio"
placeholder="Racer Statistics / Biography"
value=""><?php echo $this->bio;?></textarea>
<input type="submit" id="submit" name="modify" value="submit" />
</form>
</div>
<?php
}
public function get_racer($racerID)
{
$this->racer_id = $racerID;
$this->mysqli = new mysqli(MYSQLI_HOST,MYSQLI_USER,MYSQLI_PASS,MYSQLI_DATABASE)
or die(error(3));
$racer_info = "SELECT * FROM ArtecRacers WHERE RacerID=?";
$load_racer = $this->mysqli->prepare($racer_info);
$load_racer->bind_param('s', $racerID);
$load_racer->execute();
$load_racer->bind_result($this->racerID, $this->firstname, $this->lastname, $this->banner, $this->bio);
$load_racer->fetch();
modify_racer::send_form();
}
public function list_racers()
{
?>
<div id="form">
<h3>Select Racer:</h3>
<form method="post" action="">
<?php
$this->mysqli = new mysqli(MYSQLI_HOST,MYSQLI_USER,MYSQLI_PASS,MYSQLI_DATABASE)
or die(error(3));
$racer_list = "SELECT * FROM ArtecRacers";
$get_racers = $this->mysqli->query($racer_list);
while($list = $get_racers->fetch_array(MYSQLI_NUM))
{
echo '<input id="part" type="radio" name="editRacer" value="' . $list[0] . '"/>';
echo '<label for="part">' . $list[1] . ' ' . $list[2] . '</label><br />';
}
?>
<input type="submit" name="selectRacer" id="submit" value="Select Racer" />
</form>
</div>
<?php
}
function test2()
{
echo $this->firstname;
echo $this->lastname;
echo $this->racer_id;
}
}
$start = new modify_racer();
if(!isset($_POST['selectRacer']))
$start->list_racers();
if(isset($_POST['selectRacer']))
$start->get_racer($_POST['editRacer']);
$start->test2();
?>
Everything in the code works except at $start->test2(); all of the information pulled from the function test2() is blank, and I am not sure why... Any insights?
EDIT:
I changed the code to reflect the following on the bottom, and test2() still outputs the variables as NULL:
if(!isset($_POST['editRacer']))
$start->list_racers();
else
$start->get_racers($_POST['editRacer']);
$start->test2();
If you leave your code alone, you're going to have to pass both selectRacer and editRacer parameters into the page. My guess is that you might only want to pass the one, though. In which case, you'll want to change
if(isset($_POST['selectRacer']))
$start->get_racer($_POST['editRacer']);
into
if(isset($_POST['editRacer']))
$start->get_racer($_POST['editRacer']);
Also, if you want to pass these values in through the URL bar, you need to check $_GET, not $_POST.
And finally, everywhere that you are making method calls by executing modify_racer::my_method_here(), you should change that to $this->my_method_here(). The former is a static method call, meaning it's not actually associated with your object, meaning it can't touch those variables. For it to be able to access and change the variables, you'll need to call it through $this.

Multiply categories and bind them to Database Symfony2

i need help with my forms that i create, i created 5 forms in a twig file and created a controller , how can i bind my value from the forms to database, when i bind now it displays me only one Value form the 5 times , but i need 5 times to be different value :(, please help , I stuck on this thing all day already..
my twig file:
<div class="new-test">
<h2>New test </h2>
<form action="{{ path('test.create') }}" method="post">
Test name: <input type="text" name="name"/><br>
Category 1<input type="text" name="category-new" >
<div id="customWidget">
<div id="colorSelector1"><div style="background-color: #00ff00"></div>
</div>
<div id="colorpickerHolder1"></div>
</div>
Category 2<input type="text" name="category-new" ><br>
Category 3<input type="text" name="category-new" ><br>
Category 4<input type="text" name="category-new" ><br>
Category 5<input type="text" name="category-new" ><br>
<input type="submit" value="Add">
</form>
my controller:
/**
* #Route("/add/test", requirements={"name" = "\s+"}, name="test.create")
* #Method("Post")
* #return array
*/
public function createAction()
{
$success = 0;
$name = $this->getRequest()->get('name');
if( !empty($name) )
{
$test = new Test();
$test->setName($this->getRequest()->get('name'));
$em = $this->getDoctrine()->getManager();
$em->persist($test);
$em->flush();
$success = 'Test '.$test->getName().' was created';
}
else
{
$success = 'Test name can not be empty';
}
$category = $this->getRequest()->get('category-new');
for ($i=0; $i<=5; $i++){
if( !empty($category) )
{
$categoryName = new Category();
$categoryName->setName($this->getRequest()->get('category-new'));
$em = $this->getDoctrine()->getManager();
$em->persist($categoryName);
$em->flush();
$success = ' Category '.$categoryName->getName().$i.' was created';
}
else
{
$success = 'Test name can not be empty';
}
}
return $this->redirect($this->generateUrl('test.new'));
}
Not sure if i understand correctly. You want to have inputs with name 'category-new' that have different value. If so, you have problem in form view:
Category *<input type="text" name="category-new" ><br>
name should have bracket at the end name="category-new[]" or name="category-new[1]" for category 1, name="category-new[2]" for category 2, and so on.
Template:
Category 1<input type="text" name="category-new[]" >
<div id="customWidget">
<div id="colorSelector1"><div style="background-color: #00ff00"></div>
</div>
<div id="colorpickerHolder1"></div>
</div>
Category 2<input type="text" name="category-new[]" ><br>
Category 3<input type="text" name="category-new[]" ><br>
Category 4<input type="text" name="category-new[]" ><br>
Category 5<input type="text" name="category-new[]" ><br>
It`s meen, that your controller take array with name category-new
/**
* #Route("/add/test")
*
* #return array
*/
public function createAction()
{
$success = 0;
$name = $this->getRequest()->get('name');
if (!empty($name)) {
$test = new Test();
$test->setName($name);
$em = $this->getDoctrine()->getManager();
$em->persist($test);
$em->flush();
$success = 'Test ' . $test->getName() . ' was created';
} else {
$success = 'Test name can not be empty';
}
$categoryList = array_map('trim', $this->getRequest()->get('category-new'));
foreach ($categoryList as $category) {
if (!empty($category)) {
$categoryName = new Category();
$categoryName->setName($category);
$em = $this->getDoctrine()->getManager();
$em->persist($categoryName);
$em->flush();
$success = ' Category ' . $category . ' was created';
} else {
$success = 'Test category-new may not be empty';
}
}
return $this->redirect($this->generateUrl('test_create'));
}
Some words
Route("/add/test", requirements={"name" = "\s+"}, name="test.create")
requirements not need for you
name of this action will be project_bundlename_controller_action for you {project}_{bundlename}_test_create whereis i dont know you project name and bundle name - its not a diffucult i think for you. And some code :)

Not able to submit multiple forms on single html page

I have problem with forms on one file.
The problem is that when I click submit ... it submits the first form data instead of the form that the person filled even though as you can see from the code below that I specified a certain id for each form.
I am using a php file to submit the data to mysql
here is my code:
case 'upd_chpt':
if($_POST['does'] == 'upd_chpt')
{
$chId = $_POST['chId'];
$name = $_POST['name'];
$nums = $_POST['nums'];
$mngs = $_POST['mang'];
$ch_trans = $_POST['ch_trans'];
$ch_down = $_POST['ch_down'];
$ch_translate = $_POST['ch_translate'];
$ch_clean = $_POST['ch_clean'];
$ch_editor = $_POST['ch_editor'];
if(!empty($chId) && !empty($name) && !empty($nums) && !empty($mngs) && !empty($ch_trans))
{
$mnG = explode(',' , $mngs);
$qup = $db->query("UPDATE chapter SET ch_name = '".$name."', chapter_num = '".$nums."', manga_id = '".$mnG[0]."', manga_title = '".$mnG[1]."', manga_name = '".$mnG[2]."', ch_down = '".$ch_down."', ch_translate = '".$ch_translate."', ch_clean = '".$ch_clean."', ch_editor = '".$ch_editor."', ch_trans = '".$ch_trans."' WHERE ch_Id = '".$chId."' ");
if($qup)
{
echo "updated successfully";
}
else
{
echo "erorr ";
}
}
else
{
echo "please fill all the fields !";
}
}
break;
html code :
<form id="edit_{$ch[ch].ch_Id}">
<input type="hidden" name="chid" value="{$mn[mn].ch_Id}" />
<label>chapter number</label>
<input type="text" id="chaptr" name="chaptr" value="{$ch[ch].chapter_num}" class="short" />
<label>chapter title </label>
<input type="text" id="name" name="name" value="{$ch[ch].ch_name}" class="short" />
<label>manga related to chapter</label>
<select id="mansga" name="manga">
{section name='mn' loop=$mng}
<option value='{$mng[mn].mn_Id},{$mng[mn].mn_title},{$mng[mn].mn_name}' {if $mng[mn].mn_Id==$ch[ch].manga_id}selected="true" {/if}>
{$mng[mn].mn_name}
</option>
{/section}
</select>
<label>chapter link</label>
<input type="text" id="ch_down" name="ch_down" value="{$ch[ch].ch_down}" class="short" />
<label>all credit goes to</label>
<input type="text" id="ch_trans" name="ch_trans" value="{$ch[ch].ch_trans}" class="short" />
<label>translated by</label>
<input type="text" id="ch_translate" name="ch_translate" value="{$ch[ch].ch_translate}" class="short" />
<label>cleaned by</label>
<input type="text" id="ch_clean" name="ch_clean" value="{$ch[ch].ch_clean}" class="short" />
<label>edited by</label>
<input type="text" id="ch_editor" name="ch_editor" value="{$ch[ch].ch_editor}" class="short" />
<label><input type="submit" class="submit" value="تعديل" /></label>
</form>
javascript :
$('[id^=edit_]').submit(function(){
var id = $(this).attr('id').split('_')[1];
var name = $('#name').val();
var nums = $('#chaptr').val();
var mang = $('#mansga').val();
var ch_trans = $('#ch_trans').val();
var ch_down = $('#ch_down').val();
var ch_translate = $('#ch_translate').val();
var ch_clean = $('#ch_clean').val();
var ch_editor = $('#ch_editor').val();
$.post("action.php", {does: 'upd_chpt' ,ch_trans:ch_trans, ch_down:ch_down, ch_translate:ch_translate , ch_clean:ch_clean , ch_editor:ch_editor , chId:id , name: name, nums: nums, mang:mang},function(m){
alert(m);
});
return false
});
can this code be changed ? and be only php + html without javascript ! ... because I think that id="" is the problem
the mistake was on the second line
{$mn[mn].ch_Id} should be {$ch[ch].ch_Id}

Categories