Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17







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


I am trying to carry out a very basic multiplication on the last line with quantity * price for a Total value and it gives me an error.

Parse error: syntax error, unexpected '*'

echo ("<p><h3>Your Order Details are:</h3></p>");

if ($productitem != "")
echo ("<p><strong>Product: </strong>".$productitem. "</p>");
echo ("<p><strong>Quantity: </strong>".$quantity. "</p>");
echo ("<p><strong>Price: </strong>".$price. "</p>");
echo ("<p><strong>Comment from Product: </strong>".$comment1. "</p>");
echo ("<p><strong>Comment from Delivery: </strong>".$comment2. "</p>");

echo ("<p><strong>Total = : $</strong>" .$price. * .$quantity. "</p>");

Open in new window

Industry Leaders: We Want Your Opinion!
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I suddenly can't seem to access my local websites on my Mac via MAMP. My ddns.log file contains the following:

mamp_dyndns[41389:21445531] DynDNS: [no update] empty username and/or password

Open in new window

I do have my DynDNS username and password stored properly in the MAMP interface, and my DynDNS account is in good standing and is configured as it's always been.

Any help on figuring this out would be appreciated.

Is it possible to bypass the need for a LAMP server (LAMP = the Linux operating system, the Apache HTTP Server, the MySQL relational database management system (RDBMS), and the PHP programming language)?

I am looking for a way to simply put some files on a file share for a specific group and let everyone have access to whatever is required to run the application, but without having access to a full LAMP server.

Can writing php files that conform to newer standards accomplish this?  If not, is there any way to accomplish this without any installs?

I have an Order HTML page where a User can enter data into fields.  On Submit PHP file is used to write the data to SQL Tables called Orders and Orders_details.

Currently, when l test this I'm getting the below error.
Below is my PHP file:
If you need table structures I can provide these too.

The line error is highlighted below.

<meta charset="utf-8">



  /* Set oracle user login and password info */
  $dbuser = ;  
  $dbpass = ;  
  $db = ;
  $connect = oci_connect($dbuser, $dbpass, $db);

   /* Display connection error if fails */
  if (!$connect)  {
    echo "An error occurred connecting to the database";

  //Extract CGI variables
  $productitem = $_POST['productitem'] ;
  $price = $_POST['price'] ;
  $quantity = $_POST['quantity'] ;
  $firstname = $_POST['firstname'] ;
  $lastname = $_POST['lastname'] ;
  $address = $_POST['address'] ;
  $phone = $_POST['phone'] ;
  $email = $_POST['email'] ;
  $creditcard = $_POST['creditcard'] ;

  // count the record in orders table and use id number $count+1 for the new record
  $query_count = "SELECT max(ID) FROM Orders";

  echo "SQL: $query_count<br>";

  /* check the sql statement for errors and if errors report them */
  $stmt = oci_parse($connect, $query_count);

  if(!$stmt)  {
    echo "An error…

I have the below search field in my HTML file.

This is connected to a PHP file on Submit.

If the User clicks on 'Search' only, without entering any data, I want all data to be displayed.
Currently, it will only display data it you enter at least one character.

Here is my SQL Select Query within my PHP file.

$query = "SELECT * FROM Products WHERE regexp_like(Title,'$book_name','i')";
Hello Experts,

This post is more or less to pick your brain about things/ideas I should implement into my current system. Basically, the only requirement for my system was turn my employer's paper-based car seat rental program into a paperless system.

Here are screenshots of my system:


(See attached PDF)

Right now, the system does the following:
  1. Presents the user (coworker) with a choice to either rent or return a car seat;
  2. Provides an inventory of any available seats (from a MySQL database);
  3. Generates a PDF version of our current rental agreement using FPDF;
  4. Emails the generated PDF to the renter and another department in my office (not implemented yet); and
  5. Presents the user with an HTML table in order to return any rented car/booster seats.

Being that I am a hobbyist php programmer, I am kind of in the dark when it comes to certain things. My career has nothing to do with programming, either. I enjoy PHP and took this task upon myself for fun.
I have a form with validation when the page loads I get this error (developers tools)

menu.js:89 Uncaught TypeError: Cannot read property 'left' of undefined
    at HTMLDocument.<anonymous> (menu.js:89)
    at j (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at Function.ready (jquery.min.js:2)
    at HTMLDocument.J (jquery.min.js:2)
(anonymous) @ menu.js:89
j @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
J @ jquery.min.js:2

The page is:


I can figure out what the problem is
using email version4 app on android7
i mark hostupon hosted linux php email as spam but same senders keep sending email
I have seen a few questions like this and variations of this but I am still confused as how to go about doing this. I have different dealers in different regions and want to list them by region in one long list.

West Coast
dealer 1
dealer 2
dealer 3

East Coast
dealer 1
dealer 2
dealer 3

And so on...

I have a database table with a list of regions and another table with a list of dealers.

The dealer table has a column which contains the region id from the regions table so I can join the tables.

I tried this:

$stmt = $link->prepare("SELECT `region_name`, `dealer_name` FROM `dealer_region` as `dr` INNER JOIN `dealers` as `d` ON dr.`id` = d.`region_id` GROUP BY `region_name`");
$result = $stmt->get_result();
$numRows = $result->num_rows;
if($numRows > 0) {
    while($row = $result->fetch_assoc()) {
        $dealer_name = $row['dealer_name'];
        $region_name = $row['region_name'];
        echo $region_name . "<br />" . $dealer_name . "<br />";


Open in new window

But this only results in one dealer being shown under each region instead of all.
is this a php script?how to use it? is for creating a source.txt

$ips = $_POST['ips'];
$users = $_POST['users'];
function rand_string( $length ) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$size = strlen( $chars );
for( $i = 0; $i < $length; $i++ ) {
$str .= $chars[ rand( 0, $size - 1 ) ];
return $str;
$key = rand_string(8) . ".txt";
$fh = fopen($key, 'w') or die("can't open file");
$ips=explode("\n", $ips);
$users=explode("\n", $users);
foreach($ips as $ip){
foreach($users as $user){
$string= $ip.":".$user;
$string = preg_replace('/\s+/', '', $string);
fwrite($fh, $string);
fwrite($fh, " \r\n"); }}
$print = "Done! Poti sa descarci fisierul sursa si sa il adaugi in dubrute <a href=http://hiphopize.me" . $key . " >Click</a>";
echo $print;

Open in new window

<body><form method="POST" action=create.php>Ips:<textarea id="ips" name="ips" cols="40" rows="15"></textarea>Users:<textarea id="users" name="users" cols="40" rows="15"></textarea><br><input type="submit" value="Show them all!"></center><br>

Open in new window

On Demand Webinar - Networking for the Cloud Era
LVL 10
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

I have a Wordpress Loop that Generates names from a query.  However, sometimes the name is repeated.  I only want to show the name once.  Is there anyway to limit this?

  $args = array(
                    'posts_per_page' => -1,
                    'post_type' => 'post',
                    'category_name' => $alias,
                    'meta_key'	=> 'Athlete Name',
                $wp_query = new WP_Query($args);
                        <li class="show-all">
                        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                                $key_name = get_post_custom_values($key = 'Athlete Name');
                                $keyname = $key_name[0];

                                <!--  START Custom Player Menu  --> 

                                <li class="<?php echo $keyname; ?>">
                                    <?php echo $keyname; ?>
                                <!--  END Custom Player Menu  --> 

Open in new window

So if that list generates a list of 10 names and John Doe appears twice, I only want that name to appear once. Is it Group BY and how do you add that into a Wordpress Query?
This isn't very critical since it is allowing me to still get the result I am looking for, but it still bothers me.

I have the following php function (the $runnumber and echo statements were added to follow the flow, they will be removed):
function verifydate($dueDate,$length,$runnumber) {
  echo "Run number: " . $runnumber . "<br>";
  echo "Current due date: " . $dueDate . "<br>";
  $dayName = strftime("%A", strtotime("$dueDate"));
  echo "Current day of week: " . $dayName . "<br>";
  if ($dayName == "Saturday") {
    $length = $length + 2;
    $dueDate = date("Y-m-d", mktime(0, 0, 0, date("m"),date("d")+$length,date("Y")));
    echo "Since the day is Saturday, adding 2 more days to the due date and checking again.<br><br>";
    $runnumber = $runnumber + 1;
  if ($dayName == "Sunday") {
    $length = $length + 1;
    $dueDate = date("Y-m-d", mktime(0, 0, 0, date("m"),date("d")+$length,date("Y")));
    echo "Since the day is Saturday, adding 1 more day to the due date and checking again.<br><br>";
    $runnumber = $runnumber + 1;
  $conn2 // a connection to my database.
  $sql = "SELECT dayID FROM excludedDays WHERE excludedDay = '$dueDate'";
  $result = $conn2->query($sql);
  echo "Since the day is not on a weekend, checking to see if it is an excluded day using the MySQL query:<br>";
  echo $sql . "<br>";
  echo "Which returned " . $result->num_rows . " result.<br>";

Open in new window

Hi experts, I am trying to prepare my data for display using my function html, as below.  

I am trying to do it all in one go, but the array_walk_recursive doesn't seem to be working as expected - basically, O'Flanagan is displaying as O in my form.  It's the first time I have used it.  Or maybe the problem is that I don't understand how htmlspecialchars works, ie it doesn't actually change the parameter given to it.

function html($text)
	return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');

$sql = "SELECT ts_team_code, ts_team_name, ts_managername, ts_manager_details, ts_instructions
	     FROM teams_seasons t";

$arr_fobg_teams = $dbi->db_select($sql,'Error occurred with FOBG team');


Open in new window

and then eg. echo $arr_fobg_teams[1]['ts_managername'] shows O

if I say  echo html($arr_fobg_teams[1]['ts_managername']) it's fine.... shows O'Flanagan

Where am I going wrong?
Hello experts,

Here is my code:

<input type="checkbox" name="seat_rented[]" value="<?php echo $row['seat_serial'];?>">
$n = count($seat);
foreach($seat as $x) {
    $pdf-> Write(0, $x . ", ");

Open in new window

I only want to concatenate the comma when $n is >1. If $n equals 1, I want to concatenate a period. I can't think of the if or while statement to handle this...
I'm a Beginner. Skill Set means Which Web technologies needs to learn.and how to learn like training manual,courses,books,Practice,Senior's Guidance.I don't want to be a Full-stack developer.i want to be a back-end developer(web applications,dynamic web pages).
I am rewriting a url so instead of:


Open in new window

it is:


Open in new window

Instead of using $_GET['id'] and passing the ID, I am passing the slug i.e.: $_GET['slug']

I have the slug saved in the database but also have the record ID. I would feel more comfortable using the ID but just wanted to know if it is okay to use the slug or what is the best practice?
I want to add php plugin in netbeans 8.2 on my computer.

The problem is there is no internet connectivity on that computer so i cannot install plugin through netbeans itself using following method

Tools-> plugin -> available plugins.

so, how  would i able to make php application on my computer.
  is there anyway to download plugin from another computer having internet connectivity and then make it installed on my computer.

I am currently changing the code for a Web application (written with Angular.JS and the ionic framework with jQuery) that has a page generator. This generator page writes the image information into a relational database (phpMyAdmin, 10.1.22-MariaDB). What I have to do is to add a new form to this app where the user selects an existing page from a list & opens it in the page generator.

The <div> element that holds the image object is created in the page generator with a $templateCache.put command and has the following form:

"$templateCache.put("ivm-image-builder/templates/image-builder.html", "
	"<div class=\"hero\"\n" +
"		<div class=\"hero-image\" ivm-bg-axis=\"y\" ivm-bg-drag ivm-bg-disabled=\"disabled\" ng-style=\"imageOptions.style\" ngf-background=\"ngModel\"></div>\n" +

Open in new window

The code runs properly when creating a new page. When using this generator page for an existing page that had been saved in the database, I can easily fill the text fields (like "page name" or "URL" (a text field)), but I wonder how the images can be displayed properly. I wonder if a longtext field or a BLOB is the appropriate field type in the DB.

My question is: How can I display an image received from the database, which has no associated URI & is not saved at any accessible location? Is it the right way to associate the image information with the ngModel tag?
Hello Experts,

Currently, my car seat return system looks like this:
Return Inventory
BUT, how would I accomplish something like this?
I want to query the necessary tables. I want to display the renters' information from the renters table and the car seats they've currently rented from the rental agreement table.

I have the following MySQL tables:
  1. Renters (which contains all of the renters' information)
  2. Car Seats (which contains all of our car seats, and is used in an inventory application)
  3. Rental agreement (which contains information from the car seats and renters table)

Here's how my tables are structured:


Car Seats:
Car Seats

Rental Agreement
Rental Agreement Structure
Technology Partners: We Want Your Opinion!
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I have what seems impossible.

Note these code sections. First, a form field called "agency", done like this:
<div class="row">
	<div class="col-sm-6 col-xs-6 text-right" style="padding-top:3px;">Agency:&nbsp;</div>
	<div class="col-sm-6 col-xs-6 text-left"  style="padding-top:3px;"><select name="agency" onChange="set_form();">
	<option value="">-- Select Agency -- </option>
	<? for ($i = 0; $i < $nf; $i++) {
		$f = mysqli_fetch_array($resf,MYSQLI_ASSOC);
		$sel = "";
		if ($_SESSION['form'] == $f['agency']) {
			$sel = "selected";
		} ?>
		<option value="<? print $f['agency']; ?>" <? print $sel; ?>><? print $f['agency']; ?></option>
	<? } ?>	

Open in new window

Next, the javascript function set_form(), like this:
function set_form() {
		t = document.st.asstyp.value;
		if (document.st.agency.value != "Houston") {
			if (free == "FR") {
				jj = confirm("This form requires subscription fee. Continue?");
				if (! jj) {
					document.st.agency.value = "Houston";
					return false;
				} else {
					alert("going to subscriben.");
					document.st.action = "subscribet.php?fr=f&ag=" + document.st.agency.value;
		document.st.action="save_form.php?t=" + t;

Open in new window

Finally, the code in subscribet.php:
echo "entered subscribe test<br>";

Open in new window

Note  the alerts in the function set_form(). When I pick a value other than Houston from the dropdown, the alerts display, but but NEVER goes to subscribet.php.

Obviously I have tried to break this down to it's simplest elements. The "real" subscribe.php program does much more.

The result is that it jumps to another version of the first program called form.php.

If it drops through to the end of set_form(), it will go to save_form.php which will have the effect of what is happening. The way I see the logic, that is impossible.

I am probably just missing the obvious. I have tried running this in Firefox with Firebug turned on & Chrome with F11. They show nothing.

Can someone see what is wrong?

Hi everyone. I am looking for a way to split two kind of strings into assoc arrays:

a = 1 AND b = "text0" OR c = "text1"

Should produce:
 'a' => 1,
 'b' => "text0",
 'c' => "text1"

a = 1,b = "text0",c = "text1"

Should produce:
 'a' => 1,
 'b' => "text0",
 'c' => "text1"
I want to build a web app that has a lookup field on my form to get data from a 3rd party Restful api.  It would make a url call to the service like : http://www.something.com/api/?id=12345. It passes 1 value.  That call would return 4 values.  Those values would populate my 4 form fields.  Upon save, I would save that data to my database. I planned to use c# and javascript and a MSQL or MySQL db.   I'm open though since it's from scratch.  I'm looking for maybe a HTML, Javascript, DB example or HTML, Javascript, DB, C# or PHP example.  Does anyone have an example of how to do that?
I'm using the template escaped php/html file type for Magento (.phtml), I'm assuming it's the same with things like Smarty, but when I do a switch statement, the only way I could make it work was by aligning all of the  'case XXX' statements down the LHS as apparently 'switch' 'cases' can't have any white space between them....? really? the code looks really strange, especially as the whole clause is nested in 'if' clauses.
I have this code:
<?php echo Html::anchor('admin/reports/download/customerprofile/csv', 'Download CSV'); ?> 
<?php if ($columns && $rows): ?>
<table class="table table-striped" id="list-table">
    <?php foreach($columns as $key => $label): ?>
      <th><?php echo $label; ?></th>
    <?php endforeach; ?>

  <?php foreach($rows as $row): ?>
    <?php foreach ($columns as $key => $label): ?>
      <td><?php echo $row[$key]; ?></td>
    <?php endforeach; ?>
  <?php endforeach; ?>  

<?php else: ?>
<p>No Customers.</p>

<?php endif; ?>

Open in new window

As you can see I am using fuel, however the data is about 874 pages (im using datatables) and it takes forever to load. I found there is a way to load each page on its own with server-processing, but i'm not sure how to to the server-processing script since the query is from many tables, and the columns arent exactly shown, any ideas on how I can make the loading faster?
I have a form that allows the user to attach a document. Everything comes through the email except for the attachment.
 $user_id                =  $_GET['user'];
if(isset($_POST['email'])) {
	//Get the uploaded file information

    $email_to = "support@xxxxx.biz";
    $email_subject = "LMS 2.0 Bug Report";
    function died($error) {
        // Error code
        echo "We are very sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please go back and fix these errors.<br /><br />";
    // validation expected data exists
    if(!isset($_POST['name']) ||
        !isset($_POST['email']) ||
        !isset($_POST['comments'])) {
        died('We are sorry, but there appears to be a problem with the form you submitted. Please make sure that all required fields are completed');       
    $full_name = $_POST['name']; // required auto populated
    $email_from = $_POST['email']; // required auto populated
	$operating_system = $_POST['os']; // required
	$browser = $_POST['browser']; // required
	$feedback_type = $_POST['feedback-type']; // required
	$feedback_location = $_POST['feedback-location']; // required
    $comments = $_POST['comments']; // required
	 //Get uploaded file data
    $file_tmp_name    = $_FILES['my_file']['tmp_name'];
    $file_name        = $_FILES['my_file']['name'];

Open in new window







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.