PHP

119K

Solutions

33K

Contributors

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

Share tech news, updates, or what's on your mind.

Sign up to Post

<?php include("db.php");?>
<!DOCTYPE html>
<html>
<head>


</HEAD>
<BODY>

<div id="product-grid">
	<div class="txt-heading">Products <a href="docs.php" id="btnEmpty">Back</a></div>
	
	<?php
	
$doc_array=array();
	$doc_array="SELECT * FROM docs ";
	$agg_array="SELECT * FROM Ministore_aggrement ";
	$store_array="SELECT * FROM Office_images ";
	$result = mysqli_query($con,$doc_array);
	$result1 = mysqli_query($con,$agg_array);
	$result2 = mysqli_query($con,$store_array);
	?>
	<table border="2">
   <tr>
      <th>AADHAR CARD</th>
       <th>PAN CARD</th>
      <th>CANCELLED CHEQUE</th>
      <th>PASSBOOK</th>
       <th>GST</th>       
    </tr>
    <?php
		while($row = mysqli_fetch_assoc($result))  
      {
	
	?>
	<tr>
		<td><img src="<?php echo $row["adhar"]; ?>" width="50%" height="30%"></td>
			<td><img src="<?php echo $row["pan"]; ?>" width="50%" height="30%"></td>
			<td><img src="<?php echo $row["canceled"];?>" width="50%" height="30%"></td>
			<td><img src="<?php echo $row["passbook"]; ?>" width="50%" height="30%"></td>
			<td><img src="<?php echo $row["gst"]; ?>" width="50%" height="30%"></td>

	</tr>
<?php 
}

 ?>
	  </table>
 
 <table border="2">
   <tr>
      <th>Date</th>
       <th>Proprietory</th>
      <th>Firm</th>
      <th>Place</th>
       <th>Signatory</th>       
    </tr>
    <?php
		while($row = mysqli_fetch_assoc($result1))  
      {
	
	
echo'<tr>';
		echo'<td>'.$row["date"].'</td>';
		echo'<td>'.$row["Proprietor_name"].'</td>';
		

Open in new window

0
Cloud Class® Course: CompTIA Healthcare IT Tech
LVL 12
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Hi,

I need help regarding the auto populate of data based on the previous data from mysql database.
I have one drop down and on selecting the any of the option that will auto fill the multiple input fields in PHP foam from database.

Thanks in advance.
0
I'm asked this question a lot... and while they do have different roles and different defined tasks... they also have an obvious and common tasks and responsibilities.

I would like to hear from a few other people here, as i'm sure a lot of the community here falls into one of these departments, and you might also have one of these titles.

Head of Product VS Head of Engineering VS CTO

What are their main tasks and responsibilities?
0
AJAX/mySQL form not posting to database (actually not executing at all.  Execution just stops after signup.js has launched.  The post function just dosen't connect. I'm working in FF Quantum 60.0.1 (Mac). The only error on web console complains that the site is not https. Maybe FF is blocking execution because of that?  

My directory structure is:
registration
  _include
      signup_process.php
 _js
      signup.js
signup.php

<!DOCTYPE html>
<html lang="en">

    <head>
    <!-- Required meta tags -->
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

      <meta name="keywords" content="">
      <meta name="description" content="Client Sign Up Panel">
      <meta name="author" content="www.pricelearman.com | Palm Springs, CA">
      <title>New Client Sign Up</title>

      <link rel="stylesheet" href="./_css/main.css" crossorigin="anonymous">

       <!--[if lt IE 11]>
      <a href="./browserUpdate.com"></a>
      <![endif]-->
    </head>

    <body>

    <div class="form-wrapper">
    <h5>Secure New Client Register</h5>
    <!--<div class="alert" id="error-msg">
    </div>
    <div class="alert alert-success" id="success-msg">
    </div>
  -->
    <form  id="signup-form" name="signup-form" method="post">
      <div class="form-group">
       <!-- <label for="name" class="sr-only">Full Name</label> -->
       <input type='hidden' name='submitted' id='submitted' value='1'>
        

Open in new window

0
I am working on php mysql.I have used tcpdf to generate pdf.

I have developed code for displaying tables HAVING details of number of employees category wise.
there are four categories
DRDS  (under drds again sub categories are there like Sc. B, Sc. D etc)
DRTC    (under drtc  again sub categories are there like TO. B , TO. C etc)
ADMIN  (under Admin again sub categories are there like Sc. B, Sc. D etc)
ALLIED  (under allied again sub categories like halwai, vehicle operator etc)

i am using two while loops

first while loop is for category (each tim e loop will run for one category)

second while loop is for sub categories

in this manner when a outerloop is run for first time it will display one table.(also calculating count of employees in that category)
loop will run for 4 times as there are 4 categories and  in this way four tables will be displayed.

at the end total number of employees of all categories is displayed

In my tcpdf i want to display all these data into one table only instead of displaying separate tables.

currently it is displaying four tables
I want that  query result  from all four loops should be stored in one array so that it can be displayed in one table

generated pdf is attached

tcpdf php code is here
<?php
ob_start();
extract($_GET);
include("../../config.php");
require_once('tcpdf_include.php');
$pdf = new TCPDF('L', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

$pdf->SetPrintHeader(false);

Open in new window

0
I have Windows Server 2012 R2 configured with IIS, MySQL and PHP for hosting basic HTML5/PHP Bootstrap sites and a number of Wordpress sites.

Which CPU is better for this sort of use, and why?

  •    Intel i7-3615QM @ 2.3GHz
  •    Intel i5-4570 @ 3.2GHz

Both are running 16GB DDR3 RAM.
0
I am moving to WooCommerce and I am presently using Prestashop 1.5.  I have all of what I needed transferred over to the new site and cart.  With the exception, of the images.  Can someone tell me how I can export my images to a csv file which I can then import into WooCommerce?

I am on a Centos 6 server using php for the Prestashop installation.

Thanks,

Randal
0
Hi Experts

Could you point how to apply a Bootstrap datepicker on this specific case?

PHP
 <div class="form-group">
	<label for="nome">Data de Início</label>
	<input type="text" class="form-control" id="datainicio" name="datainicio" placeholder="Data de Início" value="<?php echo $Sessao::retornaValorFormulario('datainicio'); ?>" required>
</div>	

Open in new window


Javascript (jQuery)

<script type="text/javascript" >
    $(document).ready(function(){
      var date_input=$('input[name="datainicio"]'); 
      var container=$('.bootstrap-iso form').length>0 ? $('.bootstrap-iso form').parent() : "body";
      var options={
        format: 'mm/dd/yyyy',
        container: container,
        todayHighlight: true,
        autoclose: true,
      };
      date_input.datepicker(options);
    })
</script>


<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/js/bootstrap-datepicker.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/css/bootstrap-datepicker3.css"/>

Open in new window


The way above doesn't works out.

Thanks in advance!
0
<form method="post" action="" enctype='multipart/form-data'>
		
			<div class="form_box">
			
				<table>
				<tr>

				<td>PASSPORT</td>
          	        <td> <input type='file' name='passport' /><td>
				</tr>				
				<tr>
					<td>ADHARCARD</td>
					<td><input type='file' name='adhar' /></td>
				</tr>
				
				<tr>

				<td><label>PAN</td>
          	         <td><input type='file' name='pan' /></td>
      			</tr>

      			<tr>

				<td>CANCELED CHEQUE</td>
          	        <td> <input type='file' name='canceled' /></td>
      			</tr>
				
				<tr>
					<td>BANK PASSBOOK</td>
					<td><input type='file' name='passbook' /><td>
				</tr>
				
      			<tr>
      				<td> GST Number</td>
					<td><input type='file' name='gst' /></td>

      			</tr>
    
				<tr>
					
					<td><input type="submit" value="submit" name="submit" class="submit"></td>
					<td><input type="reset" value="Reset" name="B2" class="submit"></td>
					</tr>
					<tr>
					<td><a href="agrrement.php" id="btnEmpty">GO</a></td>

					</tr>
				</div>

Open in new window



This is my php code here i'm uploading images

include("db.php");

if(isset($_POST['submit'])){
 
 $target_dir = "product-images/";
 $target_file1 = $target_dir . basename($_FILES["passport"]['name']);
 $target_file2 = $target_dir . basename($_FILES["adhar"]['name']);
 $target_file3 = $target_dir . basename($_FILES["pan"]['name']);
 $target_file4= $target_dir . basename($_FILES["canceled"]['name']);
 $target_file5 = …
0
Hi

I have a PHP application that uses an SQL Server database.

I am trying to use the "Always Encrypted" feature to encrypt certain fields in my database.

I have run the wizard with SSMS and encrypted the fields, using the auto CEM and CEK options. The certificate is stored in the windows certificate store. The fields are now shown as being encrypted when I access them through my PHP application and when I use SSMS.

After I have added the "Column Encryption Setting=Enabled" to SSMS, the data is decrypted when I run a query, but when I run the php application with the "ColumnEncryption => "enabled" added to the connection string, I get no results returned.

I am thinking that this is because the php application might not have permission to use or see the certificate in the window store, but I am not sure how to grant permissions to it.

I would also like to know the best way to "backup" my certificates so that if I ever lost the server, I could restore and use a backup of the database.

I would appreciate any help you can offer!

My sql version is Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64) Web Edition (64-bit) on Windows Server 2016 Datacenter 10.0 <X64> (Build 14393: ) (Hypervisor), I am using PHP 7.2.2

Thanks
0
Cloud Class® Course: SQL Server Core 2016
LVL 12
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

I need to logout for my website so  I'm trying logout automatically for every 4 hour once ,i'm not getting how to do  so  please let me know the solution
<form action="index.php" method="post" name="frm"><input name="uname" type="text" placeholder="User Name" />
<input name="pass" type="password" placeholder="Password" />
<input name="submit" type="submit" value="submit" />
</form>

Open in new window



<?php
//on pageload
session_start();

$idletime=60;//after 60 seconds the user gets logged out

if (time()-$_SESSION['timestamp']>$idletime){
    session_destroy();
    session_unset();
}else{
    $_SESSION['timestamp']=time();
}

//on session creation
$_SESSION['timestamp']=time();

Open in new window




how to send session variable from html to php please help me to get solution .

Thank you
0
<?php
include("db.php");

if(isset($_POST['submit'])){
 
 $name=$_POST['name'];
$code=$_POST['code'];
$price=$_POST['price'];
 $name1 = $_FILES['image']['name'];
 $target_dir = "product-images/";
 $target_file = $target_dir . basename($_FILES["image"]["name"]);
echo $target_file;
 
  // Insert record
  $query = "insert into tblproduct(`name`,`code`,`image`,`price`) values('$name','$code','".$target_file."','$price')";
 $q1= mysqli_query($db,$query) or die(mysqli_error($db));
  if($q1)
{
	echo "Product inserted";
	//header("Location:sell_add_products.php");
}
	else
	{
		echo"data not inseted";
	}

  // Upload file
  //move_uploaded_file($_FILES['image']['tmp_name'],$target_dir.$name1);
 //}
 
}
?>

Open in new window


This is my docs.php for inserting data into table

<HTML>
<HEAD>
<TITLE>Simple PHP Shopping Cart</TITLE>
<link href="css/style_products.css" type="text/css" rel="stylesheet" />
 
</HEAD>
<BODY>

<div id="product-grid">
	<div class="txt-heading">Products <a href="sell_add_products.php" id="btnEmpty">Back</a></div>
	<?php
	include("db.php");
$product_array=array();
	$product_array="SELECT * FROM tblproduct";
	$result = mysqli_query($db,$product_array);
		while($row = mysqli_fetch_assoc($result))  
      {
	if (!empty($product_array)) { 
		foreach($product_array as $key=>$value){
	?>
		<div class="product-item">
			<form method="post" action="">
			<div class="product-image"><img src="<?php echo $product_array[$key]["image"]; ?>"></div>
			<div><strong><?php echo $product_array[$key]["name"]; ?></strong></div>
			<div class="product-price"><?php echo "$".$product_array[$key]["price"]; ?></div>
			<div><input type="text" name="quantity" value="1" size="2" /><input type="submit" value="Add to cart" class="btnAddAction" /></div>
			</form>
		</div>
	<?php
			}
		}
	}
	?>
</div>
</BODY>
</HTML>

Open in new window


here I'm rretrieving data from table but I'm facing problem

Warning: Invalid argument supplied for foreach() in C:\wamp\www\Ministore\view_products.php on line 19

please let me know the solution  for this problem
0
I'm trying to override 2 different JS files in my WordPress site's child theme, and am running into some major difficulty.

Here is the site URL: https://staging.royalpalm.com/

My goal is to change these 2 lines ..

<script type='text/javascript' src='https://royalpalm.com/wp-content/themes/houzez/js/houzez_ajax_calls.js?ver=1.5.7.3'></script>
<script type='text/javascript' src='https://royalpalm.com/wp-content/themes/houzez/js/custom.js?ver=1.5.7.3'></script>

Open in new window


To this:

<script type='text/javascript' src='https://royalpalm.com/wp-content/themes/houzez-child/js/houzez_ajax_calls.js?ver=1.5.7.3'></script>
<script type='text/javascript' src='https://royalpalm.com/wp-content/themes/houzez-child/js/custom.js?ver=1.5.7.3'></script>

Open in new window



This is what I currently have in my functions.php file .. in attempt to override these 2 JS files:

------------------------------------------------------------------------------

function remove_scripts() {
    wp_dequeue_script( 'houzez_ajax_calls' );
    wp_dequeue_script( 'houzez-custom' );    
}

add_action( 'wp_print_scripts', 'remove_scripts' );

wp_enqueue_script('myscript_ajax_calls', get_stylesheet_directory_uri() . '/js/houzez_ajax_calls.js', array('jquery'), null, true);

wp_enqueue_script('myscript_custom', get_stylesheet_directory_uri() . '/js/custom.js', array('houzez_ajax_calls'), null, true);

Open in new window


.. But I'm not able to dequeue the "houzes_ajax_calls" script for some reason.  I'm able to insert the houzes_ajax_calls.js file from my child theme, .. but the placement of it is incorrect (above the localized script that references "var HOUZEZ_ajaxcalls_vars" ) .. and the houzes_ajax_calls.js file 's now being duplicated.

If you view the underlying source code for the homepage, you'll see that the problem starts at around line #3690:

https://staging.royalpalm.com/

What am I doing wrong here?  And more importantly, how can I control the specific placement of the JS files in the bottom footer?

- Yvan
0
Wordpress - WooCommerce.  I have successfully created a Custom Field for a variable product.  It saves and update and does everything it is supposed to do to.  However, It is not showing the value in the field once I have updated the field, (It is Not echoing the value in the form field). Line 16 should be showing the value like the other fields. The image attached shows "Warehouse Location"  that is the Placeholder for the field.  The field has been set but not showing.

Here is the function:

function tlg_variation_warehouse_fields($loop, $variation_data, $variation) {
    // Select
    global $wpdb;
 
    
    echo '<div class="variation-custom-fields">';

    woocommerce_wp_text_input(
            array(
                'id' => '_warehouse_location_field['. $loop .']', 
                'class' => 'warehouse-location-input',
                'label' => __('Warehouse Location', 'woocommerce'),
                'placeholder' => 'Warehouse Location',
                'desc_tip' => 'true',
                'description' => __('Begin typing the warehouse location here to populate a list.', 'woocommerce'),
                'value' => get_post_meta($variation->ID, '_warehouse_location_field', true)
            )
    );

    echo '</div>';

Open in new window

warehouse_location.PNG
0
<!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>
<title>Check out</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
<!--
.style9 {font-size: 95%; font-weight: bold; color: #003300; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style10 {color: #FFFFFF}
-->
</style>
</head>
<body>


<form action="" method="POST">
<?php

 include("includes/db.php");
$total=0;
if(isset( $_POST['checkout'] ) )
{
 
$price = "select cart.p_id,cart.ip_add,cart.qty,products.prd_title,products.prd_price from cart inner join products on cart.p_id =products.prd_id";

   $run_price = mysqli_query($con,$price) ;

  
      while($ppprice = mysqli_fetch_array($run_price)){

         $product_id = $ppprice['p_id'];
         $ip_add = $ppprice['ip_add'];
         $qty = $ppprice['qty'];
         $product_title = $ppprice['prd_title'];
         $product_price = array($ppprice['prd_price']);
        

         $price_sum = array_sum($product_price);

         $total +=$price_sum;
        
        echo '<label>Product Id</label><input type="text" value='.$ppprice['p_id'].'>';
         echo ' <label>Order Id</label><input type="text" value='.$ppprice['ip_add'].'>';

 echo '<label>Quantity</label><input type="text" value='.$ppprice['qty'].'>';

 echo 

Open in new window

0
Severity: Core WarningMessage:  PHP Startup: PDO: Unable to initialize module
Module compiled with module API=20060613
PHP    compiled with module API=20131226
These options need to match
Filename: UnknownLine Number: 0



Getting when i try to run php from cli in windows7
0
<?php

$dbhost = "localhost"; 
$dbuser = "root"; 
$dbpass = ""; 
$dbname = "student"; 

$conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
$sid = $_GET["sid"]; 
$name = $_POST["txtName"];
$add = $_POST["txtAddress"];
$city = $_POST["txtCity"];
$state = $_POST["txtState"]; 
$country = $_POST["txtCountry"];
$zip = $_POST["txtZip"];
$contect = $_POST["txtContact"];
$email = $_POST["txtEmail"];
if($sid >0)
{
$sql = "UPDATE studreg SET name='" . $name . "', add=" . $add . ", city='" . $city . "', state='" . $state . "', 
country='" . $country . "', zip='" . $zip . "', contect='" . $contect . "', email='" . $email ." WHERE sid=" . $sid;
}
else
{
$sql = "INSERT INTO studreg (name, add, city, state, country, zip, contect, email) VALUES ('".$name ."',".$add.",'".$city."','".$state."','".$country."','".$zip."','".$contect."','".$email.")";
}


$conn->query($sql);


$conn->close();
 
header("location:registration.php" );

?>

Open in new window

0
Hi Exoerts

Could you point how to correctly positionate a paginator by using Bootstrap's "mobile first" feature?

The code I'm using:
 <div class="search col-xs-5 col-sm-8 col-md-8 col-xl-12">
	<?= $this->element('/paginacao') ?>
 </div>

Open in new window


When using a large device it's well positionated:
img002
But , when using a small device it isn't well positionated
img001
Device features used:
img003
Could you suggest what must to be changed (or added) to make it to be correct?

Thanks in advance!
0
I need to send below command and get output from Linux server using PHP coding. I need it badly. I can execute below command through windows CMD.

telnet xx.xx.xx.xx 7777
login = LGI: HLRSN =15,OPNAME="x",PWD="y";
search = LST MSCNUM: ISDN="88000000000";
0
Cloud Class® Course: Python 3 Fundamentals
LVL 12
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

i am using tcpdf to generate pdf using php. i am displaying output using tables.
i want to apply css for alignment of tables using <div>
 how can i add external css file to tcpdf code
0
I have a custom dll file that`s name Encryptor and I added it ext folder of php
then I called it in Php.ini file
but I am unable to use that dll function

Dll File name is Encryptor
class name is zCypto
function name is Encrypt

So can you tell me how to call custom dll function

Thank You
Regards Mohan Singh
0
I'm having a problem with a menu.  I'm trying to clean up code from an old site and I can't figure out why the menu will not display across the top.
I'm pretty sure that the problem has to do with the css.  I copied the code from one to the other.
Take a look at "langsystems.net" and click on "Retail".   Do the same thing at "Seabreezesoftware.com".  You'll see the problem.
If you need to look at the code, let me know.
0
I am a newbie to the web development world and I need help from time to time. Right now I am trying to send a csv file in email an attachment. I am able to generate the csv file but I can't figure out the code to tell it to send or even where to put the code...

I am sure that phpmailer is my answer somehow, I have already downloaded all the phpmailer files. I have read so many different options but they don't really give step by step answers.
0
Just Moved my wordpress site to IIS10 with latest version of php. It works for a while after which it gives a weird error. And then I would need to restart the server for it to work.

Error from the windows error log.

Faulting application name: php-cgi.exe, version: 7.2.2.0, time stamp: 0x5a7219e5
Faulting module name: ucrtbase.dll, version: 10.0.14393.2097, time stamp: 0x5a820a13
Exception code: 0xc0000005
Fault offset: 0x000000000001f344
Faulting process id: 0x1074
Faulting application start time: 0x01d3eb881c85e262
Faulting application path: C:\Program Files\PHP\v7.2\php-cgi.exe
Faulting module path: C:\Windows\System32\ucrtbase.dll
Report Id: a805c7d4-4b03-4a18-ae4e-af14a5eed2f9
Faulting package full name:
Faulting package-relative application ID:

Any idea how to fix.

Thanks
Manoj
0
I am developing an attendance system in which the attendance is taken by the a teacher and then saved to the database. However, I am having a trouble with saving the data to the database. when i click on "submit attendance" the data won't be submitted to the database. i use register.php to register students but take the attendance in different file (teacher.php). Below is the code i use to take attendance  (teacher.php) and a file to save it to sql database (save-attendance.php)..

I can't be able to filter the class. Also the session value displays an error which says "undefined " even if i set it.
Can someone help me? Thanks.


<?php
    $pageTitle = 'Take Attendance';
    include('header.php');
    require("db-connect.php");
    if(!(isset($_COOKIE['teacher']) && $_COOKIE['teacher']==1)){
        echo 'Only teachers can create new teachers and students.';
        $conn->close();
        include('footer.php');
        exit;
    }
    //get session count
    $query = "SELECT * FROM attendance";
    $result = $conn->query($query);
    $sessionCount=0;
    setcookie('sessionCount', ++$sessionCount);
    if(mysqli_num_rows($result)>0){
        while($row = $result->fetch_assoc()){
            $sessionCount = $row['session'];
            setcookie('sessionCount', ++$sessionCount);
        }
    }

    if(isset($_GET['class']) && !empty($_GET['class'])){
        $whichClass = $_GET['class'];
        $whichClassSQL = "AND class='" . $_GET['class'] . "'";
    } else {

Open in new window

0

PHP

119K

Solutions

33K

Contributors

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.