Search found 606 matches

by element121
Fri Feb 10, 2017 7:39 am
Forum: PHP coding => General
Topic: Syntax error inside php form
Replies: 4
Views: 503

Re: Syntax error inside php form

Code: Select all

<?php
// Put HTML into variable
$form = "<form action='./login.php' method='post'><h1>Hello</h1></form>";
// Output HTML from the variable
echo $form;
?>
by element121
Mon Jan 30, 2017 6:34 am
Forum: JavaScript
Topic: Php javascript combination
Replies: 2
Views: 431

Re: Php javascript combination

You would need to use an AJAX call to POST the value of the JS variable to PHP code.
by element121
Tue Jan 24, 2017 10:56 am
Forum: JavaScript
Topic: javascript data mysql database
Replies: 5
Views: 485

Re: javascript data mysql database

Do you see any error messages in the console?

You can use some debug statements in your PHP code to figure out if the data is getting posted correctly.
by element121
Tue Jan 24, 2017 6:46 am
Forum: JavaScript
Topic: javascript data mysql database
Replies: 5
Views: 485

Re: javascript data mysql database

It looks like you are missing some code here: data: ele //you can use this request object to know what's the status of your response The data section might look like this for example, which would be the name of the fields you are posting: data: { name: name, phone: phone } So you would need to inclu...
by element121
Sun Jan 22, 2017 5:49 am
Forum: mySQL & php coding
Topic: howto query sum of different columns with different conditions...
Replies: 2
Views: 497

Re: howto query sum of different columns with different conditions...

Code: Select all

WHERE 
player_home = 'Rob' 
OR player_away = 'Rob';
by element121
Sun Jan 22, 2017 5:46 am
Forum: PHP coding => General
Topic: Form doesn't function
Replies: 5
Views: 588

Re: Form doesn't function

At first, you will need to change the action on this line:

Code: Select all

<form id="main-contact-form" name="contact-form" method="post" action="#">
to

Code: Select all

<form id="main-contact-form" name="contact-form" method="post" action="Sendemail.php">
Hope that helps,
Jon
by element121
Wed Jan 18, 2017 6:35 am
Forum: PHP coding => General
Topic: help in array sum
Replies: 5
Views: 414

Re: help in array sum

It looks like the problem is your are re-using variables for the inner and outer for loops.
Change them so that your $sql and $row variables are distinct based on their usage.
For example $sql_cart and $sql_product...
by element121
Tue Jan 17, 2017 11:48 am
Forum: News and Announcements
Topic: Forum updates
Replies: 0
Views: 738

Forum updates

What happened to the forum, new logo and slightly different look now.

Also it appears lots of original posts got deleted, but the replies are still showing, but the number of replies shows as 0?
by element121
Tue Jan 17, 2017 11:22 am
Forum: PHP coding => Mail
Topic: Send email using the answer from a form
Replies: 1
Views: 497

Re: Send email using the answer from a form

Normally you would have a method value on your form tag so you can POST the data back to the server: <form id="form" class="bottom_form fix" action="action.php" method="POST"> Then you will be able to access the values entered into the form with PHP code like this: $_POST['name'] and $_POST['email']...
by element121
Tue Jan 17, 2017 11:16 am
Forum: mySQL & php coding
Topic: Dynamic list php&mysql
Replies: 2
Views: 463

Re: Dynamic list php&mysql

Hi, it looks like you have most of the code working, but you need a way to get the selected value into the request parameter. There are a few options, you could trigger an on change event on the select to submit the form / or use AJAX to retrieve the data then you will avoid a page reload. Or you co...
by element121
Tue Jan 17, 2017 3:31 am
Forum: PHP coding => General
Topic: help in array sum
Replies: 5
Views: 414

Re: help in array sum

What number are you expecting and what number are you getting?
by element121
Mon Jan 16, 2017 7:54 am
Forum: PHP coding => General
Topic: help in array sum
Replies: 5
Views: 414

Re: help in array sum

How should the total price be calculated? Assuming a product_id is unique and has only one product_price, then this for loop is redundant foreach($sql as $row) $product_price = array($row["product_price"]); $values = array_sum($product_price); $total += $values; } You could just have a line like thi...
by element121
Mon Jan 16, 2017 6:24 am
Forum: mySQL & php coding
Topic: How do I Update in PDO please.
Replies: 4
Views: 608

Re: How do I Update in PDO please.

Here is a simple PHP PDO Update example:
http://element121.com/2016/07/09/how-to ... using-php/
And the full source code:
https://github.com/element121/cars-exam ... r/edit.php

Hope that helps,
Jon
by element121
Sat Jan 14, 2017 7:38 am
Forum: mySQL & php coding
Topic: My Problem with dropdownlist in mysql,php
Replies: 11
Views: 1598

Re: My Problem with dropdownlist in mysql,php

In addition to what AdoptiveSolution has said, your error comes from this line, concatenating a string to the variable $select that doesn't exist on the first iteration of the loop: { $select.='<option value="'.$row[0].'">'.$row[0].'</option>'; You need to define a variable before using it. You can ...
by element121
Sat Jan 14, 2017 7:27 am
Forum: PHP General
Topic: Best Steps to learn php
Replies: 4
Views: 401

Re: Best Steps to learn php

MySQL normally refers to the database MySQL. PHP can use a number of drivers to access the MySQL database to read, write, update, delete data / objects. The oldest of the these is also referred to as MySQL (it's now deprecated), it was then improved to MySQLi. The modern and recommended way to conne...
by element121
Fri Jan 13, 2017 10:56 am
Forum: PHP General
Topic: Best Steps to learn php
Replies: 4
Views: 401

Re: Best Steps to learn php

That looks like some good steps to get going. Do you have any prior programming experience? To run PHP you will need some form of web server, you can run one locally for easy development. To help other people get started, I wrote a few instructions here, with a link to WAMPSERVER: http://element121....
by element121
Fri Jan 13, 2017 6:26 am
Forum: PHP Installation
Topic: Installed php PDT thru Eclipse install Software what Next
Replies: 2
Views: 427

Re: Installed php PDT thru Eclipse install Software what Next

Not sure what the eclipse tools install for you, but you can install something like WAMPSERVER which will give you PHP and MySQL together. To help other people get started, I wrote a few instructions here, with a link to WAMPSERVER: http://element121.com/2016/02/13/how-to-get-started-with-php-as-a-c...
by element121
Thu Jan 12, 2017 11:15 am
Forum: mySQL & php coding
Topic: Need Help for Payroll of School Management System
Replies: 1
Views: 287

Re: Need Help for Payroll of School Management System

You would need to provide more detailed specifications of the required functionality for suggestions of "DB Structure, tables for Payroll and flow of Payroll.". Google is your friend though and can help you find some existing open source payroll systems written in PHP. https://www.google.ca/search?q...
by element121
Wed Jan 11, 2017 10:54 am
Forum: PHP coding => General
Topic: Need help in creating a php site using api
Replies: 1
Views: 295

Re: Need help in creating a php site using api

How well do you know PHP?

Have you looked at some example code from Google / Youtube on their site?

https://developers.google.com/youtube/v ... amples/php
by element121
Fri Dec 02, 2016 3:50 am
Forum: PHP coding => General
Topic: header() function not redirecting
Replies: 6
Views: 960

Re: header() function not redirecting

You can still use it, you just need to organize your code so that the re-direct comes before any output to the browser.
by element121
Thu Nov 24, 2016 3:46 am
Forum: PHP coding => General
Topic: PHP not displaying page that references topic.php
Replies: 0
Views: 454

Re: PHP not displaying page that references topic.php

Hi, it shouldn't be a problem naming a file topic.php
A blank page can often indicate errors, view the source of the page in the browser to see if there are any?
Also turn on PHP error reporting if it's not already, so you can see any errors displayed.
Can you share any of the code on here?
by element121
Thu Nov 24, 2016 3:39 am
Forum: PHP coding => General
Topic: header() function not redirecting
Replies: 6
Views: 960

Re: header() function not redirecting

Any HTMl is "output", along with echo statements, spaces and line breaks that are before the function call.
You can't modify the headers once something has been output.
by element121
Mon Nov 21, 2016 2:18 pm
Forum: PHP coding => General
Topic: header() function not redirecting
Replies: 6
Views: 960

Re: header() function not redirecting

For header to work, it needs to be executed before any output to the browser (including spaces). If you aren't seeing an error on your page, check your error logs. From the manual, with example code that will give an error, the html tag and line will need to be removed for this to work. http://php.n...
by element121
Mon Nov 21, 2016 2:12 pm
Forum: mySQL & php coding
Topic: MySQL group event times per day
Replies: 0
Views: 1209

Re: MySQL group event times per day

You are probably going to need to first get all the distinct dates and then for each day load the data into PHP, loop through the records working out the elapsed time and if any time "overlaps" as you say.