Search found 628 matches

by element121
Mon Jul 16, 2018 10:35 am
Forum: PHP coding => Images
Topic: Tweak inline image styling to divide max-width by half
Replies: 2
Views: 308

Re: Tweak inline image styling to divide max-width by half

Not in the brackets, but just after:

Code: Select all


$obj->width() / 2 

by element121
Sun Jul 08, 2018 3:34 am
Forum: PHP coding => General
Topic: Alt image
Replies: 3
Views: 293

Re: Alt image

Yes, that was just an example of the HTML, you can replace the alt text with a string from a variable.
But you will need to define that variable or pass it into the function.
by element121
Fri Jul 06, 2018 10:46 am
Forum: PHP coding => General
Topic: Alt image
Replies: 3
Views: 293

Re: Alt image

Hey,
Yes just add the alt to this line:

Code: Select all

    $post_content .= '<img src="' . $my_uploaded_image[0] . '" alt="Alt text">';
by element121
Wed Jul 04, 2018 10:48 am
Forum: PHP General
Topic: Debugging PHP code using Brackets!
Replies: 1
Views: 255

Re: Debugging PHP code using Brackets!

You could use something like this:

https://github.com/spocke/php-debugger
by element121
Wed Jul 04, 2018 10:46 am
Forum: PHP coding => General
Topic: redirect page after success login
Replies: 1
Views: 4371

Re: redirect page after success login

Hi,

If I understand you correctly, you can just concatenate the variable together like this:

Code: Select all


header("location: ". $_POST["classgroupid"] .".php");  

You should really do some validation on the POSTed fields coming from the form though.
by element121
Fri Jun 29, 2018 8:57 am
Forum: PHP coding => Mail
Topic: Using SVG tags in Mail()
Replies: 1
Views: 863

Re: Using SVG tags in Mail()

What errors are you getting and where's your svg code?
by element121
Thu Jun 14, 2018 9:42 am
Forum: PHP Scripts
Topic: Help with PHP SQL query
Replies: 1
Views: 682

Re: Help with PHP SQL query

Hi,

Appreciate this is an old post, but first thing to check is if every table has indexes set-up on the columns you are joining on.
Also it's best to specify exact column names you need from the invoices table, so instead of i.* you would have i.my_column_name1 etc....

Regards,
Jon
by element121
Mon Jun 11, 2018 7:54 am
Forum: PHP coding => General
Topic: Looking for Donut Chart code?
Replies: 3
Views: 409

Re: Looking for Donut Chart code?

You could use some JS/AJAX to update the chart with values from PHP.
by element121
Sun Jun 10, 2018 7:01 am
Forum: PHP coding => General
Topic: Looking for Donut Chart code?
Replies: 3
Views: 409

Re: Looking for Donut Chart code?

Hi,

I've Google charts before, this is there Donut chart:
https://developers.google.com/chart/int ... onut-chart

Regards,
Jon
by element121
Thu Jun 07, 2018 10:26 am
Forum: PHP coding => Images
Topic: Uploading images to server from web page-change error notify
Replies: 5
Views: 629

Re: Uploading images to server from web page-change error notify

Hi Rick,

Maybe you can share the code you have so far on here?

Thanks,
Jon
by element121
Thu Jun 07, 2018 10:23 am
Forum: PHP coding => General
Topic: Insert php inside double quotes
Replies: 2
Views: 362

Re: Insert php inside double quotes

Try changing your code to this:

Code: Select all


$myfile = fopen($pagetitle .".php", "w") or die("Unable to open file!");
            $txt = "test\n";
            fwrite($myfile, $txt);
            $txt = "test\n";
            fwrite($myfile, $txt);
            fclose($myfile);
 

by element121
Mon Jun 04, 2018 10:16 am
Forum: PHP coding => Mail
Topic: Several Form Input Into Mail Body Message Using PHPMailer
Replies: 1
Views: 440

Re: Several Form Input Into Mail Body Message Using PHPMailer

Hi, You need to concatenate multiple fields together. In your code the second line here will overwrite the first line: $mail->Body = $_POST["outlet"]; //An HTML or plain text message body $mail->Body = $_POST["message"]; You can add a few characters to concatenate the variables together in different...
by element121
Mon Jun 04, 2018 10:12 am
Forum: PHP coding => Images
Topic: display image by using selected field as directory
Replies: 1
Views: 725

Re: display image by using selected field as directory

Hi,

You could do this with PHP or JavaScript might be better.
Sorry I can't write the code for you, what do you have already, that you've tried?

Regards,
Jon
by element121
Mon Jun 04, 2018 10:10 am
Forum: PHP coding => Images
Topic: Uploading images to server from web page-change error notify
Replies: 5
Views: 629

Re: Uploading images to server from web page-change error notify

Hi,

You can do that by using AJAX to upload the image in the page and update a label with success or failure message.

A quick google, will bring you tutorials like this:

https://code.tutsplus.com/tutorials/upl ... -net-21077

Hope that helps,
Jon
by element121
Mon Jun 04, 2018 7:41 am
Forum: mySQL & php coding
Topic: Optimise this function
Replies: 2
Views: 526

Re: Optimise this function

Hi,

Looks like you could do all of this with one SQL statement using the INSERT ... SELECT
More at the manual:
https://dev.mysql.com/doc/refman/8.0/en ... elect.html

Hope that helps,
Jon
by element121
Mon Jun 04, 2018 7:29 am
Forum: PHP coding => General
Topic: No values in dropdown box
Replies: 4
Views: 485

Re: No values in dropdown box

Hi Chris,

What code do you see when you view source in the browser?
(In Chrome you can view source with Ctrl+U or right click "View page source")

I'm guessing from previous experience you will see an error message there?

Regards,
Jon
by element121
Fri Jun 01, 2018 8:16 am
Forum: PHP coding => General
Topic: session don't save vars
Replies: 1
Views: 308

Re: session don't save vars

Hi,

Where are you looking for it to be saved?
Do you mean just in the session variable?

Code: Select all

$_SESSION['uname'] = $_POST['uname'];

var_dump($_POST['uname']);
var_dump($_SESSION['uname']);
Try var_dumping both out, what do you see?
by element121
Fri Jun 01, 2018 8:13 am
Forum: PHP coding => General
Topic: No values in dropdown box
Replies: 4
Views: 485

Re: No values in dropdown box

Hi Morph,

Welcome!
There are different ways of concatenating strings and variables together, personally I would do like this:

Code: Select all

<?php
echo '<option value="'. $soReference .'">'. $soTitle .'</option>';
Hope that helps,
Jon
by element121
Fri Jun 01, 2018 8:07 am
Forum: PHP coding => General
Topic: no data outputted after login
Replies: 3
Views: 398

Re: no data outputted after login

I don't see the alias in the where clause... Are you looking at this?

Code: Select all

INNER JOIN members ON repairs.customer_ref=members.customer_ref WHERE id ='".$ref['customer_ref']."'") as $row) {

Code: Select all

as $row
isn't part of the SQL query, it's part of the foreach loop.
by element121
Wed May 30, 2018 10:49 am
Forum: PHP General
Topic: how to Keep input value after form submit?
Replies: 1
Views: 386

Re: how to Keep input value after form submit?

Hi,

This might be a typo on your post, but your index.php file includes form.php.
But you've included forum.php?

Otherwise is there one input in particular you having a problem with?
by element121
Wed May 30, 2018 10:41 am
Forum: PHP coding => General
Topic: no data outputted after login
Replies: 3
Views: 398

Re: no data outputted after login

Hi, I don't see anything obvious from a quick look at your code, but do you know how far the code is getting, what's being output to the browser when view the source of the page? Good to throw in some var_dump() statements so you can step through and see what is being returned, for example: var_dump...
by element121
Wed May 30, 2018 10:36 am
Forum: PHP coding => General
Topic: My Force Download Code isn't working correctly
Replies: 1
Views: 325

Re: My Force Download Code isn't working correctly

Hi,

Try changing your Content-Type to this:

Code: Select all

    header('Content-Type: application/csv');
Hope that helps,
Jon
by element121
Fri Feb 10, 2017 7:39 am
Forum: PHP coding => General
Topic: Syntax error inside php form
Replies: 4
Views: 1307

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: 1147

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: 1424

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.