the website hoster upgraded tot php 7
the code
else{
$insert="Insert into voedselinfo(voedselnaam,Eenheid,Kcal,Eiwit,Koolh,Vet)
values('".$voedselnaam."','".$Eenheid."','".$Kcal."','".$Eiwit."','".$Vet."','".$Koolh."')";
$rs=mysql_query($insert) or die(mysql_error());
?>
<script>alert('Data Entry Saved!');</script>
<?php }
}
}
?>
does not work anymore....
should it be?
else{
$insert="Insert into voedselinfo(voedselnaam,Eenheid,Kcal,Eiwit,Koolh,Vet)
values('".$voedselnaam."','".$Eenheid."','".$Kcal."','".$Eiwit."','".$Vet."','".$Koolh."')";
$rs=mysqli_query($insert) or die(mysqli_error());
?>
<script>alert('Data Entry Saved!');</script>
<?php }
}
}
?>
but doesn't seem to work either, the alert doesn't show up anymore, nothing happens...
<!DOCTYPE html>
<head>
<title>Voedsel toevoegen bug 6</title>
<!-- Bootstrap -->
<link href="css/bootstrap.css" rel="stylesheet">
<script src="js/bootstrap.min.js"></script>
</head>
<body>
<br><br>
<h3>Controleer dat de waarden correct naar het overzicht (View Data) worden overgezet.<h3>
<div class="left">
<form class="span4" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<fieldset>
<legend>Voedsel toevoegen</legend>
<label>voedselnaam<span class="required">*</span></label>
<input type="text" name="voedselnaam" class="input-xlarge" placeholder="voedselnaam" value="<?php if(isset($_POST['voedselnaam'])){ echo $_POST['voedselnaam']; }?>" autofocus>
<label>Eenheid<span class="required">*</span></label>
<input type="text" name="Eenheid" class="input-small" placeholder="" value="<?php if(isset($_POST['Eenheid'])){ echo $_POST['Eenheid']; }?>">
<br/>
<label>Kcal<span class="required">*</span></label>
<input type="text" name="Kcal" class="input-small" placeholder="" value="<?php if(isset($_POST['Kcal'])){ echo $_POST['Kcal']; }?>">
<br/>
<label>Eiwitten<span class="required">*</span></label>
<input type="text" name="Eiwit" class="input-small" placeholder="" value="<?php if(isset($_POST['Eiwit'])){ echo $_POST['Eiwit']; }?>">
<br/>
<label>Koolh.<span class="required">*</span></label>
<input type="text" name="Koolh" class="input-small" placeholder="" value="<?php if(isset($_POST['Koolh'])){ echo $_POST['Koolh']; }?>">
<br/>
<label>Vet<span class="required">*</span></label>
<input type="text" name="Vet" class="input-small" placeholder="" value="<?php if(isset($_POST['Vet'])){ echo $_POST['Vet']; }?>">
<?php
if(isset($_POST['getdata'])){
$conn=mysqli_connect('localhost','masked','masked01');
mysqli_select_db("database",$conn);
// $regexp = "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[#][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}$/";
$voedselnaam=$_POST['voedselnaam'];
$Eenheid=$_POST['Eenheid'];
$Kcal=$_POST['Kcal'];
$Eiwit=$_POST['Eiwit'];
$Koolh.=$_POST['Koolh'];
$Vet=$_POST['Vet'];
$var=mt_rand(0,1);
if($var == 1 || 0) {
if($Vet >15 && $Eiwit >10)
{
echo "<label class='err'>You found bug#3: The system crashes by testing this way. Great Job!</label>";
}
elseif($Vet ==15 && $Eiwit ==10)
{
echo "<label class='err'>You found bug#4: Boundry value analyses. (only in combination of both boundry) Great Job!</label>";
}
elseif($Vet >15)
{
echo "<label class='err'>You found bug#2: Fat bigger then 15</label>";
}
elseif($Eiwit >10)
{
echo "<label class='err'>You found bug#1: Eiwit bigger then 10 </label>";
}
else{
$insert="Insert into voedselinfo(voedselnaam,Eenheid,Kcal,Eiwit,Koolh,Vet)
values('".$voedselnaam."','".$Eenheid."','".$Kcal."','".$Eiwit."','".$Vet."','".$Koolh."')";
$rs=mysql_query($insert) or die(mysql_error());
?>
<script>alert('Data Entry Saved!');</script>
<?php }
}
}
?>
<br/> <button type="submit" name="getdata" class="btn">Submit</button>
View Data
</fieldset>
</form>
</div>
<?php
function save(){
}
?>
</body>
</html>
Related
I have created a simple form type page as follows,
<form action="" method="GET" >
<div class="input-group mb-3">
<input type="text" name="search" required value="<?php if(isset($_GET['search'])){echo $_GET['search']; } ?>" class="form-control" placeholder="Search data">
<button type="submit" class="btn btn-primary">Search</button>
</div>
</form>
I need to type a text in search box(name ="search") and after clicking submit I need to filter the sql data as follows.
<?php
$con = mysqli_connect("10.62.96.133", "root", "", "cdrextend");
if(isset($_GET['search']))
{
$filtervalues = $_GET['search'];
$query="***";
$query_run = mysqli_query($con, $query);
if(mysqli_num_rows($query_run) > 0)
{
foreach($query_run as $items)
{
?>
<tr>
<td><?= $items['***']; ?></td>
<td><?= $items['***']; ?></td>
</tr>
<?php
}
}
else
{
?>
<tr>
<td colspan="2">No Record Found</td>
</tr>
<?php
}
}
?>
Whenever I hit submit button after typing something in text box, it redirects to login page and I am not getting any results.Can someone show me where I have messed up?
Hi change your forms submit action="" to action="<?php echo htmlspecialchars($_SERVER[" PHP_SELF "]);?>"
<form action="<?php echo htmlspecialchars($_SERVER[" PHP_SELF "]);?>" method="GET" >
<div class="input-group mb-3">
<input type="text" name="search" required value="<?php if(isset($_GET['search'])){echo $_GET['search']; } ?>" class="form-control" placeholder="Search data">
<button type="submit" class="btn btn-primary">Search</button>
</div>
</form>
I have a blog I am building with entries. I have a form with hidden variables to submit the entryID and other data to "delete" the post. The button always shows below the entry, instead of beside it.
I have tried using CSS Clear, and putting everything in a single <p> line to see if that helps. I feel like the issue is that there is a form with hidden variables, but I'm not sure how to fix this.
<div id="subformposts">
<?php echo $subentry['Body']; ?>
<?php echo $subentry['CreateDate']; ?> - <?php echo $subentry['UserName']; ?><br />
<!-- Determine whether to show the delete button -->
<form action="Delete_entry.php" method="post" id="Deletesub<?php echo $subentry['EntryID'];?>" onsubmit="return confirmdelete('Deletesub<?php echo $subentry['EntryID'];?>')">
<input type="hidden" readonly="true" name="EntryID" value="<?php echo $subentry['EntryID']; ?>" />
<input type="hidden" readonly="true" name="UserID" value="<?php echo $subentry['UserID']; ?>" />
<?php if ($userid == 1 || $userid == $res['UserID']) { ?>
<input type="image" src="redx.png" alt="Delete Post" id="btnDelete" value="Delete Post" />
<?php } ?>
</form>
</div>
I want to see the button floating to the right of my entry, (or to the left at this point.) If I could have it tucked into the div that would be great.
You can use display: inline-flex on subformposts.
Like this one :
<div id="subformposts" style="display: inline-flex;">
<?php echo $subentry['Body']; ?>
<?php echo $subentry['CreateDate']; ?> - <?php echo $subentry['UserName']; ?><br />
<!-- Determine whether to show the delete button -->
<form action="Delete_entry.php" method="post" id="Deletesub<?php echo
$subentry['EntryID'];?>" onsubmit="return confirmdelete('Deletesub<?php echo $subentry['EntryID'];?>')">
<input type="hidden" readonly="true" name="EntryID" value="<?php echo $subentry['EntryID']; ?>" />
<input type="hidden" readonly="true" name="UserID" value="<?php echo $subentry['UserID']; ?>" />
<?php if ($userid == 1 || $userid == $res['UserID']) { ?>
<input type="image" src="redx.png" alt="Delete Post" id="btnDelete" value="Delete Post" />
<?php } ?>
</form>
</div>
Or you can keep both in two different div and put display:inline-block on both of those div. Like this .
<div id="subformposts" style="display: inline-block;">
<?php echo $subentry['Body']; ?>
<?php echo $subentry['CreateDate']; ?> - <?php echo $subentry['UserName']; ?><br />
</div>
<div style="display: inline-block;">
<!-- Determine whether to show the delete button -->
<form action="Delete_entry.php" method="post" id="Deletesub<?php echo
$subentry['EntryID'];?>" onsubmit="return confirmdelete('Deletesub<?php echo $subentry['EntryID'];?>')">
<input type="hidden" readonly="true" name="EntryID" value="<?php echo
$subentry['EntryID']; ?>" />
<input type="hidden" readonly="true" name="UserID" value="<?php echo
$subentry['UserID']; ?>" />
<?php if ($userid == 1 || $userid == $res['UserID']) { ?>
<input type="image" src="redx.png" alt="Delete Post" id="btnDelete" value="Delete Post" />
<?php } ?>
</form>
</div>
I want to create custom repeater controller for theme, for this i tried but i am stuck with issue and i am unable to save any changes to my repeater section, any help is highly appreciated, here is link to my code
The code for customizer class is
if (class_exists('WP_Customize_Control')):
class Test_Testimonial_Control extends WP_Customize_Control {
public $type = 'textarea';
public function render_content() {
?>
<div class="test-rep-section-wrap">
<div class="test-rep-section">
<h3 class="test-title"><?php echo esc_html( $this->label ); ?></h3>
<div class="test-contents">
<input type="text" name="testimonial" placeholder="Image URL" id="img-link-testimonial">
Upload Image
<span><?php _e('Description Text','text-domain'); ?></span>
<textarea rows="2" style="width:100%;"><?php echo esc_textarea( $this->value() ); ?></textarea>
<input type="text" name="cl_name" placeholder="Name">
</div>
Add More
<input <?php $this->link(); ?> type="hidden" value="<?php echo esc_attr($this->value()); ?>"/>
</div>
</div>
<?php
}
}
endif;
jquery code is
$('.test-contents').hide();
$('body').on('click', '.test-title', function(){
$('.test-contents').slideToggle();
});
$('body').on('click', '.new_section', function(){
var tCount = 0;
$('.test-rep-section-wrap').append('<div class="test-rep-section"><h3 class="test-title">Testimonial Options</h3><div class="test-contents" style="display: block;"><input type="text" name="testimonial" placeholder="Image URL" id="img-link-testimonial">Upload Image<span>Description Text</span><textarea rows="5" style="width:100%;"></textarea><input type="text" name="cl_name" placeholder="Name"></div>Add More<input data-customize-setting-link="ripple_pro_testimonial_repeater" type="hidden" value=""><div class="delete-test-feature">Delete Feature</div></div>');
});
$(document).on('click', '.delete-test-feature > a', function(){
$(this).parents('.test-rep-section').remove();
});
How can it be done to submit when i change radio button from On to Off or from Off to On. My HTML code is :)
<div class="centered3">
<div class="wrapper">
<form action="oralive-csv.php" method="post" name="fshi_shkruaj">
<td><input style="margin-bottom:10px; float:right;" type="submit" name="submit" value="Shko Live" /></td>
<table style="width:950px;">
<tr>
<th style="float:left;color:#900;">Titulli</th>
<th style="color:#900;">Nentitulli</th>
<th style="color:#900;">Live</th>
</tr>
<?php $i=0; foreach ($results as $result) : ?>
<tr>
<td style="padding-right:5px;height:1.5em;">
<input type="hidden" name="id<?php echo $i; ?>"value="<?php echo $result['id'] ?>" />
<input type="hidden" name="title<?php echo $i;?>"value="<?php echo htmlspecialchars($result['text'],ENT_NOQUOTES,'UTF-8');?>" />
<div class="textndrysho"><input style="font-size:16px;color:#000;width:200px;" type="text" name="title<?php echo $i;?>" value="<?php echo htmlspecialchars($result['text'],ENT_NOQUOTES,'UTF-8'); ?>" maxlength="32"/>
</td></div>
<td style="padding-right:5px;height:1.5em;">
<input type="hidden" name="id<?php echo $i; ?>"value="<?php echo $result['id'] ?>" />
<input type="hidden" name="subtitle<?php echo $i;?>"value="<?php echo htmlspecialchars($result['subtext'],ENT_NOQUOTES,'UTF-8');?>" />
<div class="textndrysho"><input style="font-size:16px;color:#000;width:400px;" type="text" name="subtitle<?php echo $i;?>" value="<?php echo htmlspecialchars($result['subtext'],ENT_NOQUOTES,'UTF-8'); ?>" maxlength="45"/>
</td></div>
<td style="padding-right:5px;height:1.5em;">
<input type="hidden" name="id<?php echo $i; ?>"value="<?php echo $result['id'] ?>" />
<input type="hidden" name="vendi<?php echo $i;?>"value="<?php echo htmlspecialchars($result['vendi'],ENT_NOQUOTES,'UTF-8');?>" />
<div class="textndrysho"><input style="font-size:16px;color:#000;width:120px;" type="text" name="vendi<?php echo $i;?>" value="<?php echo htmlspecialchars($result['vendi'],ENT_NOQUOTES,'UTF-8'); ?>" maxlength="12"/>
</td></div>
<td>
<label><input type="radio" name="shfaq<?php echo $i; ?>" value="1" id="radiobuttonsondazh_0" <?php if($result['live']==1) echo 'checked'; ?> onclick="document.getElementById('myForm').submit();" />Po</label>
<label><input type="radio" name="shfaq<?php echo $i; ?>" value="0" id="radiobuttonsondazh_1" <?php if($result['live']==0) echo 'checked'; ?> onclick="document.getElementById('myForm').submit();" />Jo</label>
</td>
<td>
<input type="checkbox" name="chk<?php echo $i; ?>" >Fshi
</td>
</tr>
<?php $i = $i+1;
endforeach;
?>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><input style="margin-top:26px;" type="submit" name="submit" value="Shko Live" /></td>
</tr>
</table>
<input type="hidden" value="<?php echo $i = $i-1; ?>" name="saka" /> </form>
</div>
</div></center>
I have try it to onChange Submit this form but not lucky. :(
Can anyone please help me?
You may need to use some javascript it has special what they call event handlers. onclick, blclick, etc. There is a way to have javascript and php code mixed together. Maybe this would work. Also what do you want this form to do that way I can help you more easily.
function dosomething()
{
var formelement = document.getElementById['theid'].value; //retrieves the value from the form element
if (formelement == "whatever")
{
window.open("http://www139.net63.net"); //opens a url in a window
}
else
{
alert("This is a popup window");
}
}
====================
<input type="radio" name="whatever" id="theid" value="your value, url etc." onclick="dosomething()">
I'd like to show this div with a "add to cart" button IF the price contained in $row_thumbs['Listino 9'] is not empty. How can that be accomplished? Jquery?
<div id="button" style="padding: 10px 0px 10px 0px;">
<form name="eCart1_1_ATC_<?php echo $row_thumbs["Cod."]; ?>" method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""; ?>">
<input type="hidden" name="eCart1_1_ID_Add" value="<?php echo $row_thumbs["Cod."]; ?>" >
<input type="hidden" name="eCart1_1_Quantity_Add" value="1" size="2" >
<input type="image" src="images/acquista.png" width="95" border="0" class="eC_ImageButton" value="Aggiungi al carrello" name="eCart1_1_ATC"></form>
</div>
uncomment the first line, then the BUTTON will be showed, make sure the script runs on a server and also I would never make spaces $row_thumbs['ListinoHERE9']
<?php
//$row_thumbs['Listino_9']='cheater';
if($row_thumbs['Listino_9']!='') {
echo '<div class="button"> B U T T O N</div>';
}
?>
<style type="text/css">
.button {
padding:5px;
width:100px;
background-color:gray;
}
.button:hover {
cursor:pointer;
background-color:orange;
}
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.button').click(function(){
$('.show-div-if-button-gets-clicked').toggle();
});
});
</script>
<div class="show-div-if-button-gets-clicked" style="display:none;">
<form name="eCart1_1_ATC_<?php echo $row_thumbs["Cod."]; ?>" method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".$_SERVER["QUERY_STRING"]:""; ?>">
<input type="hidden" name="eCart1_1_ID_Add" value="<?php echo $row_thumbs["Cod."]; ?>" >
<input type="hidden" name="eCart1_1_Quantity_Add" value="1" size="2" >
<input type="image" src="images/acquista.png" width="95" border="0" class="eC_ImageButton" value="Aggiungi al carrello" name="eCart1_1_ATC"></form>
</div>