Jump to content

tmwes

New Members
  • Posts

    2
  • Joined

  • Last visited

tmwes's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. PERFECT! I knew it was something simple; I assumed since when you usually call a function you DON'T have semicolons you didn't need it in the IF statement. The other problem once I cleared that hurdle was I had to declare the variables inside each condition; now it is working like a charm! function choosejob($frmfunction) { if ($frmfunction == '2') { $file_path=$_SERVER['DOCUMENT_ROOT'].'/';//Download Files path $files = $_POST['image']; $zipname = time().'LesroImages.zip'; create_zip($file_path,$files,$zipname); } else { $to = $_POST["email"]; $from = 'info@lesro.com'; $from_name = 'Lesro Industries'; $subject = 'Lesro Images'; $body = 'Here are the files you requested.'; $file_path=$_SERVER['DOCUMENT_ROOT'].'/';//Download Files path $files = $_POST['image']; smtpmailer($to, $from, $from_name, $subject, $body, $file_path,$files); } } choosejob($frmfunction)
  2. I'm kind of a jack of all trades and master of none; and by no means a PHP expert. I know enough to get by. I have an HTML form where users select the files they want, then when they submit the files are emailed to them. This function is working fine. I also want them to have the option to download the files; when I point the form to this function, it is also working fine. What I would like to do is have the user select on the form via radio button if they want email or download, and for the PHP to select the function based on that. However, I can't seem to get this basic IF statement to work. This works, and returns the value of the radio button: function choosejob($frmfunction) { if ($frmfunction === 2) { echo $frmfunction; } else { echo $frmfunction; } } choosejob($frmfunction) function choosejob($frmfunction) { if ($frmfunction === 2) { create_zip($file_path,$files,$zipname) } else { smtpmailer($to, $from, $from_name, $subject, $body, $file_path,$files) } } choosejob($frmfunction) The second snippet does not work. It returns "Parse error: syntax error, unexpected '}' in /home/lesroco/public_html/SEND/combined.php on line 108" (108 is just above the 'else') If I call either the create_zip or the smtpmailer functions instead of choose job, either work fine. I'm sure it's something simple I'm missing, but I've been banging my head against the desk trying to figure it out. Thanks in advance!
×
×
  • 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.