Only the first row of a table updates after new details are inserted in a popup form - codeigniter

In each row of a table, I have an “insert” link. When a user clicks this link, a popup window appears containing a form. When the user clicks the “save” button for the form, the form update works only for the first row of the parent table. It takes only the first row ID.
<!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>
</style>-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Popup contact form using only CSS - Demo | CodingCrazy</title>
<link href="<?php echo base_url();?>assets/css/styleform.css" rel="stylesheet" type="text/css"/>
<link href='http://fonts.googleapis.com/css?family=Electrolize' rel='stylesheet' type='text/css' />
<!--CC-->
<link rel="stylesheet" href="<?php echo base_url();?>assets/css/fonts.css"/>
</head>
</body>
</html>
<!--<link rel="stylesheet" href="<?php // echo base_url();?>assets/css/special.css" type="text/css" />-->
<div class="bal" style="margin-left: 627px;
padding: 15px;">
Balance Amount:<input type="text" name="bal">
<?php echo form_open('money_c/addrow')?>
<input type="submit" style="padding:7px;" name="sub" value="add row">
<?php echo form_close();?></div>
<table border="1">
<tr>
<th>Date</th>
<th>Description</th>
<th>Category</th>
<th>Debit</th>
<th>Credit</th>
<th>Bal.AMT</th>
<th>Insert</th>
<th> EDit/Delete</th></tr>
<?php foreach($query2 as $row)
{
$date=$row->date;
$desc=$row->description;
$credit=$row->credit;
$deb=$row->debit;
$bal=$row->bal;
$cat=$row->category;
$id=$row->id;
?>
<tr><td><?php echo $date;?></td>
<td><?php echo $desc;?></td>
<td><?php echo $credit;?></td>
<td><?php echo $deb;?></td>
<td><?php echo $bal;?></td>
<td><?php echo $cat;?></td>
<td><a href="#pop" >Insert<div id="pop" class="box">
<?php
?>
<!--<form action="" method="post" class="smart-green">-->
<div class="smart-green">
<?php
echo form_open('money_c/manualupdatesave/'.$id)?>///here updation happens only for first row id;
<h1>
<span>Please fill all the texts in the fields.</span>
</h1>
<label>
<span>Date:</span>
<input type="date" name="dat" />
</label>
<label>
<span>Description:</span>
<input name="desc" type="text" />
</label>
<label>
<span>Category:</span><select name="selection">
<?php foreach($query1 as $row1)
{
$cat=$row1->category;
?>
<!--<option value="Job Inquiry">Job Inquiry</option>-->
<option value="<?php echo $cat;?>"><?php echo$cat;?></option>
<?php
}
?>
</select>
</label>
<label>
<span>Debit:</span>
<input type="text" name="deb"></input>
</label>
<label>
<span>Credit:</span>
<input type="text" name="credit"></input>
</label>
<label>
<span> </span>
<input type="submit" style="margin-top:12px" class="button" style="background-color: #004e98;"value="Send" />
</label>
</div>
<?php echo form_close();?>
<!--</form>-->
<div id="close">
<td><img src="<?php echo base_url();?>assets/images/del.jpg" width="60" height="40"></td>
</tr>
<?php
}
?></table>
</tbody>
</table>
My controller:
money_c
function manualupdatesave($id)
{
$a=$this->input->post('dat');
$b=$this->input->post('desc');
$c=$this->input->post('cat');
$d=$this->input->post('deb');
$e=$this->input->post('credit');
$this->money_m->transaction($a,$b,$c,$d,$e,$id);
$this->load->view('header');
$result['query2'] = $this->money_m->selecttrans();
$this->load->view('manualupdate',$result);
$this->load->view('footer');
}
view page: manualupdate.php:
<!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>
</style>-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Popup contact form using only CSS - Demo | CodingCrazy</title>
<link href="<?php echo base_url();?>assets/css/styleform.css" rel="stylesheet" type="text/css"/>
<link href='http://fonts.googleapis.com/css?family=Electrolize' rel='stylesheet' type='text/css' />
<!--CC-->
<link rel="stylesheet" href="<?php echo base_url();?>assets/css/fonts.css"/>
</head>
<!--<link rel="stylesheet" href="<?php // echo base_url();?>assets/css/special.css" type="text/css" />-->
<div class="bal" style="margin-left: 627px;
padding: 15px;">
Balance Amount:<input type="text" name="bal">
<?php echo form_open('money_c/addrow')?>
<input type="submit" style="padding:7px;" name="sub" value="add row">
<?php echo form_close();?></div>
<table border="1">
<tr>
<th>Date</th>
<th>Description</th>
<th>Category</th>
<th>Debit</th>
<th>Credit</th>
<th>Bal.AMT</th>
<th>Insert</th>
<th> EDit/Delete</th></tr>
<?php foreach($query2 as $row)
{
$date=$row->date;
$desc=$row->description;
$credit=$row->credit;
$deb=$row->debit;
$bal=$row->bal;
$cat=$row->category;
$id=$row->id;
?>
<tr><td><?php echo $date;?></td>
<td><?php echo $desc;?></td>
<td><?php echo $credit;?></td>
<td><?php echo $deb;?></td>
<td><?php echo $bal;?></td>
<td><?php echo $cat;?></td>
<td><a href="#pop" >Insert<div id="pop" class="box">
<?php
?>
<!--<form action="" method="post" class="smart-green">-->
<div class="smart-green">
<?php
echo form_open('money_c/manualupdatesave/'.$id)?>
<h1>
<span>Please fill all the texts in the fields.</span>
</h1>
<label>
<span>Date:</span>
<input type="date" name="dat" />
</label>
<label>
<span>Description:</span>
<input name="desc" type="text" />
</label>
<label>
<span>Category:</span><select name="selection">
<?php foreach($query1 as $row1)
{
$cat=$row1->category;
?>
<!--<option value="Job Inquiry">Job Inquiry</option>-->
<option value="<?php echo $cat;?>"><?php echo$cat;?></option>
<?php
}
?>
</select>
</label>
<label>
<span>Debit:</span>
<input type="text" name="deb"></input>
</label>
<label>
<span>Credit:</span>
<input type="text" name="credit"></input>
</label>
<label>
<span> </span>
<input type="submit" style="margin-top:12px" class="button" style="background-color: #004e98;"value="Send" />
</label>
</div>
<?php echo form_close();?>
<!--</form>-->
<div id="close">
<td><img src="<?php echo base_url();?>assets/images/del.jpg" width="60" height="40"></td>
</tr>
<?php
}
?></table>
</tbody>
</table>
My popup form:
<?php
echo form_open('money_c/manualupdatesave/'.$id)?>
<h1>
<span>Please fill all the texts in the fields.</span>
</h1>
<label>
<span>Date:</span>
<input type="date" name="dat" />
</label>
<label>
<span>Description:</span>
<input name="desc" type="text" />
</label>
<label>
<span>Category:</span><select name="selection">
<?php foreach($query1 as $row1)
{
$cat=$row1->category;
?>
<!--<option value="Job Inquiry">Job Inquiry</option>-->
<option value="<?php echo $cat;?>"><?php echo$cat;?></option>
<?php
}
?>
</select>
</label>
<label>
<span>Debit:</span>
<input type="text" name="deb"></input>
</label>
<label>
<span>Credit:</span>
<input type="text" name="credit"></input>
</label>
<label>
<span> </span>
<input type="submit" style="margin-top:12px" class="button" style="background-color: #004e98;"value="Send" />
</label>
</div>
<?php echo form_close();?>

Related

ajax only works once a refresh

I was doing a cart section where you can change your product quantity, at first i did it with a normal form, but i change it to ajax because i want to the page doesn´t need to refresh at all to show you your new quantity with your new price and your new total, so i did the following:
$('.actform').on('submit', function(ev) {
var id2 = $(this);
$.ajax({
type: $(id2).attr('method'),
url: $(id2).attr('action'),
data: $(id2).serialize(),
success: function(data) {
$('.container').load(' .container');
},
error: function() {
alert('Ha ocurrido un error');
}
});
ev.preventDefault();
});
It was all okay when you change 1 product for first time, but the second time the forms submits like it doesn´t have ajax, to fix this problem i replaced $('.container').load(' .container'); to $('.container').load(window.location.reload(false)); and it works, but i wanna know if there is another way to do it because this reload stutters a bit the page reload and it looks weird
cart.php whithout ajax (if you need to see):
<main id="main" class="main">
<?php if(!empty($_SESSION['cart'])){ ?>
<div class="container">
<h2 class="carrito-title">Mi Carrito</h2>
<div class="container2">
<div class="container-cart">
<table>
<thead>
<tr>
<th class="product-image">Imagen</th>
<th class="product-name">Producto</th>
<th class="product-price">Precio</th>
<th class="product-quantity">Cantidad (Modificar)</th>
<th class="product-total">Total</th>
<th class="product-remove">Eliminar</th>
</tr>
</thead>
<tbody>
<?php
$total= 0;
foreach($_SESSION['cart'] as $indice=>$producto){
$ID = $producto['ID'];
$select_products = $connect->prepare("SELECT * FROM `productos` WHERE id=$ID") or die('query failed');
$select_products->execute();
$list_products = $select_products->fetchAll(PDO::FETCH_ASSOC);
foreach($list_products as $product){
$nombre= $product['nombre'];
$precio= $product['precio'];
$codigo = $product['codigo'];
$imagen = "media/productos/$codigo.png";
?>
<tr>
<td class="product-image">
<img src="<?php echo $imagen?>" alt="<?php $nombre?>">
</td>
<td class="product-name">
<h2 class="name"><?php echo $nombre?></h2>
</td>
<td class="product-price"><h2 class="precio">$<?php echo number_format($precio, 0, ',', '.') ; ?></h2></td>
<td class="product-quantity">
<form action="backend/actProduct.php" method="post" class="actform" id="<?php echo $ID ?>">
<div class="cantidad">
<div class="cantidad-container">
<input type="hidden" name="id" min="1" value="<?php echo openssl_encrypt($ID,COD,KEY);?>">
<input type="number" class="nro updateCant" onchange="btnCart.click()" name="cantidadupd" value="<?php echo $producto['CANTIDAD'];?>">
<button name="btnCart" value="Update" type="submit" class="actualizar"><i class="fa-solid fa-rotate"></i></button>
</div>
</div>
</form>
</td>
<?php
$sub_total = $precio * $producto['CANTIDAD'];
$total = $total + $sub_total;
?>
<td><h2 class="subtotal">$<?php echo number_format($sub_total, 0, ',', '.'); ?></h2></td>
<td>
<form action="backend/deleteProduct.php" method="post">
<input type="hidden" name="id" value="<?php echo openssl_encrypt($ID,COD,KEY);?>">
<button class="delete" name="btnCart" type="submit" value="Remove" onclick="return confirm('Seguro que quieres eliminar este artículo?');">X</button>
</form>
</td>
</tr>
<?php
}};
?>
</tbody>
</table>
</div>
<?php if(isset($_SESSION['cart'])){ ?>
<div class="nocart">
<div class="final">
<h5 class="final-price preciofinal">Precio sin Impuestos: $<?php echo number_format($total, 0, ',', '.');?></h5>
<form action="backend/emptyCart.php" method="post" class="emptyform" id="<?php echo $ID ?>">
<input type="hidden" name="empty">
<button name="btnCart" type="submit" class ="vaciar" value="Empty" onclick="return confirm('¿Desea vaciar el carrito?');">Vaciar carrito</button>
</form>
</div>
<?php
if ($rol=='representante'){
?>
<div class="checkout">
<form action="productos.php">
<button name="btnFinCart" class="seguircomprando-btn">Seguir comprando</button>
</form>
<a class="checkout-btn" href="clientes.php">Seleccionar cliente</a>
</div>
<?php
}else{?>
<div class="checkout">
<form action="productos.php">
<button name="btnFinCart" class="seguircomprando-btn">Seguir comprando</button>
</form>
<form action="backend/fincompra.php" method="post" onsubmit="showLoad()">
<button name="btnFinCart" class ="checkout-btn" onclick="return confirm('¿Está seguro que desea finalizar la compra?');" value="Fin" >Finalizar compra</button>
</form>
</div>
<?php
}
?>
</div>
</div>
<?php }?>
</div>
<?php }else{
echo '
<div class="nosesion">
<h2 class="cartvacio">El carrito esta vacío</h2>
<a class="comprar-btn" href="productos.php">Comprar ahora</a>
</div>
';
}?>
</main>

Having problem with this form and the select option and also the email is not send

I want this form to send email but i don't work, i don'y know where is the problem but i think the problem is in the model, also this form has a select function i cannot make it work when i choose something in the select option to send it with email
This is the controller
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Offer extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('admin_model');
$this->load->helper(array('form', 'url', 'text'));
}
public function index() {
$this->load->view('header.php');
$this->load->view('offer.php');
$this->load->view('footer.php');
}
public function sendOffer(){
if(isset($_POST['companyname']) && isset($_POST['sendername']) && isset($_POST['email']) && isset($_POST['number']) && isset($_POST['interest']) && isset($_POST['message'])){
$data['companyname'] = $_POST['companyname'];
$data['sendername'] = $_POST['sendername'];
$data['email'] = $_POST['email'];
$data['number'] = $_POST['number'];
$data['interest'] = $_POST['interest'];
$data['message'] = $_POST['message'];
$data['created_at'] = date("Y-m-d H:i:s");
$this->admin_model->sendOfferEmail($data);
$this->db->insert('offer',$data);
$true = "Message Sent Successfully ...";
$this->session->set_flashdata('true', $true);
redirect(base_url()."offer");
}else{
$error = "Failed To Send, Please check all inputs and try again !!!";
$this->session->set_flashdata('error', $error);
redirect(base_url()."offer");
}
}
}
This is the model
public function sendOfferEmail($data){
$MailTo = "menna.ashour#thetranslationgate.com";
$subject = "The Translation Gate Website offer".$data['created_at'];
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
//$headers .= "Cc: amr.hussein#europelocalize.com". "\r\n";
$headers .= 'From: The Translation Gate Website'."\r\n";
$message = '<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>Falaq| Site Manager</title>
<style>
body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
line-height: 1.428571429;
color: #333;
}
section#unseen
{
overflow: scroll;
width: 100%
}
</style>
<!--Core js-->
</head>
<body>
<div class="panel-body">
<div class="adv-table editable-table ">
<div class="clearfix">
<div class="btn-group">
<span class=" btn-primary" style="">
</span>
</div>
</div>
<div class="space15"></div>
<table class="table table-striped table-hover table-bordered" id="" style="overflow:scroll;border: 1px solid;width: 100%;text-align: center">
<tbody>
<tr>
<td style="background-color: #ddd;">Company Name</td>
<td style="background-color: #f9f9f9;">'.$data['companyname'].'</td>
</tr>
<tr>
<td style="background-color: #ddd;">Full Name</td>
<td style="background-color: #f9f9f9;">'.$data['sendername'].'</td>
</tr>
<tr>
<td style="background-color: #ddd;">Email</td>
<td style="background-color: #f9f9f9;">'.$data['email'].'</td>
</tr>
<tr>
<td style="background-color: #ddd;">Phone Number</td>
<td style="background-color: #f9f9f9;">'.$data['number'].'</td>
</tr>
<tr>
<td style="background-color: #ddd;">Message</td>
<td style="background-color: #f9f9f9;">'.$data['message'].'</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>';
mail($MailTo,$subject,$message,$headers);
}
public function getInterest($interest){
$result = $this->get_where('interest',array('id' => $interest))->row();
if(isset($result->name)){
return $result->name;
}else{
return '';
}
}
}
?>
This is the view
<section id="pageBar">
<div class="container">
<div class="row">
<h1 class="page-title pull-left">Offers</h1>
<ol class="breadcrumb pull-right">
<li>Home</li>
<li>Offers</li>
</ol>
</div>
</div>
</section>
<!-- Page-Bar -->
<!-- Login Form -->
<div id="login">
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2 col-xs-offset-0">
<form class="login-form" method="post" action="<?=base_url()?>offer/sendOffer" enctype="multipart/form-data">
<div class="form-group input-block">
<label for="name">Company Name</label>
<input type="text" name="companyname" class="form-control" id="companyname" required>
</div>
<div class="form-group input-block">
<label for="name">Full Name</label>
<input type="text" name="sendername" class="form-control" id="sendername" required>
</div>
<div class="form-group input-block">
<label for="email" style="top: 24px; font-size: 16px;">Email</label>
<input type="email" name="email" class="form-control" id="email" required="" autocomplete="off">
</div>
<div class="form-group input-block">
<label for="name" style="top: 24px; font-size: 16px;">Phone Number</label>
<input type="text" name="number" class="form-control" id="number" required="" autocomplete="off">
</div>
<div class="select-group">
<select class="form-control selectpicker" >
<option disabled="disabled" selected="" value="">Interest</option>
<option value="1">Arabic</option>
<option value="2">DTP</option>
<option value="3">Both</option>
</select>
</div>
<div class="">
<textarea name="message" id="message" class="form-control" rows="6" placeholder="Message" required="" autocomplete="off"></textarea>
</div>
<div class="text-center">
<button type="submit" class="btn btn-gray">
Submit
</button>
</div>
</form> </div>
</div>
</div>
</div>
You have disabled to blank value the select box.So you are not able select.
Remove disabled="disabled" from select box.
For mail service turn on development mode and check the error you got.

Custom contact form gives me 404 error

I've created a custom contact form for each magento product, I've set up all the files and inserted this code inside a Magento static block:
{{block type="core/template" form_action="/PersonalizzazioniEmail/index/post/" template="catalog/product/view/form-personalizzazione.phtml"}}
Here's the form-personalizzazione.phtml
<?php $productId=$this->getRequest()->getParams();
$model = Mage::getModel('catalog/product');
$_product = $model->load($productId["id"]);
?>
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->toHtml() ?></div>
<div class="page-title">
<h1><?php echo Mage::helper('contacts')->__('Contact Us') ?></h1>
</div>
<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post">
<input type="hidden" id="product" name="product" value="<?php echo $_product->getName() ?>" />
<div class="fieldset">
<h2 class="legend"><?php echo Mage::helper('contacts')->__('Contact Information') ?></h2>
<ul class="form-list">
<li class="fields">
<div class="field">
<label for="name" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Name') ?></label>
<div class="input-box">
<input name="name" id="name" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Name')) ?>" value="<?php echo $this->escapeHtml($this->helper('contacts')->getUserName()) ?>" class="input-text required-entry" type="text" />
</div>
</div>
<div class="field">
<label for="email" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Email') ?></label>
<div class="input-box">
<input name="email" id="email" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Email')) ?>" value="<?php echo $this->escapeHtml($this->helper('contacts')->getUserEmail()) ?>" class="input-text required-entry validate-email" type="text" />
</div>
</div>
</li>
<li>
<label for="telephone"><?php echo Mage::helper('contacts')->__('Telephone') ?></label>
<div class="input-box">
<input name="telephone" id="telephone" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Telephone')) ?>" value="" class="input-text" type="text" />
</div>
</li>
<li class="wide">
<label for="comment" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Comment') ?></label>
<div class="input-box">
<textarea name="comment" id="comment" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Comment')) ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
</div>
</li>
</ul>
</div>
<div class="fieldset privacy">
<ul class="form-list">
<?php if (Mage::helper('privacy')->isPrivacyEnabled()): ?>
<li>
<?php echo $this->getChildHtml('privacy.include.contacts'); ?>
</li>
<?php endif;?>
</ul>
</div>
<div class="buttons-set">
<p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
<input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
<button type="submit" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Submit')) ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></span></button>
</div>
</form>
<script type="text/javascript">
//<![CDATA[
var contactForm = new VarienForm('contactForm', true);
//]]>
</script>
But I get a 404 error when I submit the form, what could be the reason?
Thanks
Create a Custom Contact Form in Magento,Kindly visit below URLs.
http://inchoo.net/magento/magento-email/magento-custom-email-contact-form-with-notification-system/
http://ignaciogondra.com/2015/08/24/how-to-create-a-custom-contact-form-in-magento/
If you don't want to use custom code,You can use this paid extension.
https://www.magentocommerce.com/magento-connect/custom-contact-forms.html
You can also use this Product Question,It's might be fulfilled your requirement. This is free extension.
https://www.magentocommerce.com/magento-connect/product-question-1.html
Hope It's helpful for you.

echo form_open('user_authentication/new_user_registration'); rendered wrong url

I have problem about the form_open or any url in my site, maybe this is the new update of codeigniter or what. when I use its rendered a confusing syntax like http://::1/ and my form not working correctly or take me to a blank page. also my css dont work.
here is my php code.
<html>
<?php
if (isset($this->session->userdata['logged_in'])) {
header("location: http://localhost/login/index.php/user_authentication/user_login_process");
}
?>
<head>
<title>Login Form</title>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/style.css">
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro|Open+Sans+Condensed:300|Raleway' rel='stylesheet' type='text/css'>
</head>
<body>
<?php
if (isset($logout_message)) {
echo "<div class='message'>";
echo $logout_message;
echo "</div>";
}
?>
<?php
if (isset($message_display)) {
echo "<div class='message'>";
echo $message_display;
echo "</div>";
}
?>
<div id="main">
<div id="login">
<h2>Login Form</h2>
<hr/>
<?php echo form_open('user_authentication/user_login_process'); ?>
<?php
echo "<div class='error_msg'>";
if (isset($error_message)) {
echo $error_message;
}
echo validation_errors();
echo "</div>";
?>
<label>UserName :</label>
<input type="text" name="username" id="name" placeholder="username"/><br /><br />
<label>Password :</label>
<input type="password" name="password" id="password" placeholder="**********"/><br/><br />
<input type="submit" value=" Login " name="submit"/><br />
To SignUp Click Here
<?php echo form_close(); ?>
</div>
</div>
</body>
</html>
then here is the view page source. im using google chrome browser
<html>
<head>
<title>Login Form</title>
<link rel="stylesheet" type="text/css" href="http://::1/login/css/style.css">
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro|Open+Sans+Condensed:300|Raleway' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="main">
<div id="login">
<h2>Login Form</h2>
<hr/>
<form action="http://::1/login/index.php/user_authentication/user_login_process" method="post" accept-charset="utf-8">
<div class='error_msg'></div> <label>UserName :</label>
<input type="text" name="username" id="name" placeholder="username"/><br /><br />
<label>Password :</label>
<input type="password" name="password" id="password" placeholder="**********"/><br/><br />
<input type="submit" value=" Login " name="submit"/><br />
To SignUp Click Here
</form> </div>
</div>
</body>
</html>
as you can see the url of css and form are rendered a wrong url. href="http://::1/login/css/style.css"> instead of href="css/style.css">. also the form_open(). whats wrong with this?
Its because of your base_url is empty
How to set base_url()??
In config/config.php set $config['base_url'] = ''; the project URL.
Keeping base_url() empty any harm??
When you in local its ok and fine. But when you host that just add your site URL to it.
$config['base_url'] = 'www.stackoverflow.com';
Take look at this answer
and Possible duplicate of This Question

I cannot update by inserting details from a popup form

When I click the insert link in the second row it passes the ID of the first. Only the first row is updated.
My controller: money_c:
function addrow()
{
$this->load->view('header');
$this->load->view('manualupdate',$result);
$this->load->view('footer');
}
My view page: manualupdate.php:
<!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>
</style>-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Popup contact form using only CSS - Demo | CodingCrazy</title>
<link href="<?php echo base_url();?>assets/css/styleform.css" rel="stylesheet" type="text/css"/>
<link href='http://fonts.googleapis.com/css?family=Electrolize' rel='stylesheet' type='text/css' />
<!--CC-->
<link rel="stylesheet" href="<?php echo base_url();?>assets/css/fonts.css"/>
</head>
<!--<link rel="stylesheet" href="<?php // echo base_url();?>assets/css/special.css" type="text/css" />-->
<div class="bal" style="margin-left: 627px;
padding: 15px;">
<table border="1">
<tr>
<th>Date</th>
<th>Description</th>
<th>Category</th>
<th>Debit</th>
<th>Credit</th>
<th>Bal.AMT</th>
<th>Insert</th>
<th> EDit/Delete</th></tr>
<?php foreach($query2 as $row)
{
$date=$row->date;
$desc=$row->description;
$credit=$row->credit;
$deb=$row->debit;
$bal=$row->bal;
$cat=$row->category;
$id=$row->id;
?>
<tr><td><?php echo $date;?></td>
<td><?php echo $desc;?></td>
<td><?php echo $credit;?></td>
<td><?php echo $deb;?></td>
<td><?php echo $bal;?></td>
<td><?php echo $cat;?></td>
<td><a href="#pop" >Insert<div id="pop" class="box">////here pop up will come////pop up starts
</tr>
<?php
}
?></table>
</tbody>
</table>
Popup:
<div class="smart-green">
<?php
echo
form_open('money_c/manualupdatesave/'.$id)?>
<label>
<span>Date:</span>
<input type="date" name="dat" />
</label>
<label>
<span>Description:</span>
<input name="desc" type="text" />
</label>
<label>
<span>Debit:</span>
<input type="text" name="deb"></input>
</label>
<label>
<span>Credit:</span>
<input type="text" name="credit"></input>
</label>
<label>
<span> </span>
<input type="submit" style="margin-top:12px" class="button" style="background-color: #004e98;"value="Send" />
</label>
</div>
<?php echo form_close();?>//////pop up ends///////////
<!--</form>-->
<div id="close">
model: money_m:
function transaction($a,$b,$c,$d,$e,$id)
{
$this->db->where('id',$id);
$this->db->set('date',$a);
$this->db->set('description',$b);
$this->db->set('debit',$d);
$this->db->set('credit',$e);
// $data=array('date'=>$a,'description'=>$b,'debit'=>$d,'credit'=>$e);
$this->db->update('manualupdate');
}
In form_open('money_c/manualupdatesave/'.$id) I get only the first row ID, not the ID of the second row.
<a href="#pop" >Insert<div id="pop" class="box">
change this line to
<a href="#pop-<?php echo $id;?>" >Insert<div id="pop" class="box">
You you popup code is still not complete (assuming it should look like this)
<div id="#pop-<?php echo $id;?>">
<?php
echo
form_open('money_c/manualupdatesave/'.$id)?>
<label>
<span>Date:</span>
<input type="date" name="dat" />
</label>
<label>
<span>Description:</span>
<input name="desc" type="text" />
</label>
<label>
<span>Debit:</span>
<input type="text" name="deb"></input>
</label>
<label>
<span>Credit:</span>
<input type="text" name="credit"></input>
</label>
<label>
<span> </span>
<input type="submit" style="margin-top:12px" class="button" style="background-color: #004e98;"value="Send" />
</label>
</div>
<?php echo form_close();?>//////pop up ends///////////
<!--</form>-->
<div id="close">

Resources