Jump to content

[SOLVED] Syntax problem


didster

Recommended Posts

Can anyone please tell me what I am doing wrong? The syntax is wrong somewhere as the screen goes blank when processed.

 

$message .=

"\n\n-- Chk --\n\n" .

$_POST['chkno'][0] .
$_POST['chkno'][1] .
$_POST['chkno'][2] ;

if (!empty($contactname)) {
    $message .= "\n\n-- Contact Name --\n\n" . $contactname;
};

Link to comment
https://forums.phpfreaks.com/topic/100295-solved-syntax-problem/
Share on other sites

No I know, the following works fine on its own, it is part of an email that automatically sends

 

$message .=

"\n\n-- Chk --\n\n" .

$_POST['chkno'][0] .
$_POST['chkno'][1] .
$_POST['chkno'][2];

 

It is when I try adding this statement. Can I have a statement on the fly like this? Cheers...

 

if (!empty($contactname)) {
    $message .= "\n\n-- Contact Name --\n\n" . $contactname;
};

$message .=
"\n\n-- Chk --\n\n" .

$_POST['chkno'][0] .
$_POST['chkno'][1] .
$_POST['chkno'][2] ;

if (!empty($contactname)) {
    $message .= "\n\n-- Contact Name --\n\n" . $contactname;
}

 

Note the removal of the semicolon after the curly brace. That code works. It obviously doesn't produce any output, but it works. It may not be doing what you expect, but it does work.

I know that there is something wrong as without the if statement, the page processes correctly and returns the 'thankyouurl' page. When I put the if statement in, the php page tries to load up and therefore is just a blank page. Very confused!

 

@mail($to, $subject, $message, $headers);
header( "Location: $thankyouurl" );

I have done it! Not sure how, dont even know what I have done differently. The code looks exactly the same and It isn't a refresh problem.  I think that I just had some of the code ordered differently! It may have been a bug but not sure, very odd but thank you all for your help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.