Jump to content
Old threads will finally start getting archived ×

CBG

Members
  • Posts

    40
  • Joined

  • Last visited

Everything posted by CBG

  1. I have a set of if else for each of d, c and o to change the answer to either be Yes or No to check for in the code, using the below. It check the value from the form checkbox, this is working fine. if ($d == "D") { $d = "Yes"; } else { $d = "No"; } if ($c == "C") { $c = "Yes"; } else { $c = "No"; } if ($o == "O") { $o = "Yes"; } else { $o = "No"; }
  2. Thanks for the help, to you both, it is very much appreciated. It will always be a capital Y in Yes as it the value is hardcoded in the form on the checkbox in the form. If it not a capital Y, it need to fail anyway, as it means something gone wrong somewhere. I will give this a try in a bit, and mark up the solution.
  3. Would this give the option to do under the following examples below? Should of done this in the begin Here are the examples I need the statement to do: Example 1 - p No - Do nothing else p No Continue and do nothing Example 2 - p Yes, o Yes - Continue p Yes - Now change if one fo the following is Yes: d or c or o if not give an error d No c No o Yes Continue and do nothing Example 3 - p Yes, c Yes - Continue p Yes - Now change if one fo the following is Yes: d or c or o if not give an error d No c Yes o No Continue and do nothing Example 4 - p Yes, d Yes - Continue p Yes d Yes c No o No Continue and do nothing Example 5 - p Yes, d,c and o are No - give an error p Yes d No c No o No Give an error
  4. The way I need it to work is: If $p is No, then ignore and continue If $p is Yes I then need to check if one of the following $d, $c or $o is Yes If not it give an the error
  5. Hi, I am having a problem with this if and or statement. It is a part of my form validation. But if give the same error regardless The way I need it to work is like this: $p, $d, $c and $o can all be Yes or No If $p is Yes I then need to check if $d, $c or $o is Yes If not it give an the error This is the current code I have. I have tried the same code without brackets before the or part, but it give the same problem if ($p == "Yes" && ($d != "Yes" || $c != "Yes" || $o != "Yes")) { echo "error"; } Any help or fix would be great, I am sure it something silly, or maybe I got it the wrong way around or something silly like that. Thanks
  6. I have tried if like this $subject = 'Subject'; $message = 'Message goes here' . "\r\n" . 'Name: ' . $name . "\r\n" . if ($doesthishavedata != ''){ 'Does this have data: ' . $doesthishavedata . "\r\n" . } 'something else: ' . $hasdata . "\r\n" . '------------------------------------'; But get an error PHP Parse error: syntax error, unexpected 'if' (T_IF) Now if there away to break up the message into bits, then I could most likely use an if Would this work to break the message up $subject = 'Subject'; $message = 'Message goes here'; $message .= 'Name: ' . $name; $message .= 'Does this have data: ' . $doesthishavedata; $message .= 'something else: ' . $hasdata; $message .= '------------------------------------';
  7. Hi, I am using PHP to send an text email message after a form is submitted Use mail at the moment, to send a text email for example: $subject = 'Subject'; $message = 'Message goes here' . "\r\n" . 'Name: ' . $name . "\r\n" . 'Does this have data: ' . $doesthishavedata . "\r\n" . 'something else: ' . $hasdata . "\r\n" . '------------------------------------'; $to = '[email protected]'; $from = '[email protected]'; $headers = 'From: ' . $from . '' . "\r\n" . 'Reply-To: ' . $from . '' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail ($to, $subject, $message, $headers); As you can see Does this have data part, if it does not how can I remove it from being sent in the email? Thanks
  8. Just to let you know: The last update osDate had was about 1 and half years ago to osDate 2.6 (http://forum.tufat.com/showthread.php?t=67329) Me and a few others are testing the new version of osDate (osDatePDO), but I don't know of a release date.
  9. Ok how does this look, it seems to work, just a bit worried about the NC on the last RewriteRule. As I have been told NC can create opportunities for duplicate content RewriteCond %{THE_REQUEST} ^[a-zA-Z0-9_-]+\ /profile\.php\?username=([^&]+)\ HTTP/ RewriteRule ^profile\.php$ http://www.mydomain.co/%1? [R=301,L] RewriteRule ^([a-z0-9_]+)/?$ profile.php?username=$1 [NC,L] The idea is http://www.mydomain.co/ABC is normal URL, but if anyone tries https://www.mydomain.co/ABC they redirected back to http
  10. Hi, I have the below rewrite rule RewriteRule ^([a-zA-Z0-9_-]+)$ profile.php?username=$1 When I go to: http://www.mydomain.co/ABC It works fine When I go to: https://www.mydomain.co/ABC It redirects to: http://www.mydomain.co/ABC?username=ABC I am not wanting ?username=ABC when being redirected for HTTPS I am wanting to make access to this via HTTP only. I have tried to add ? in places to strip but that didn't work and broke it Any help please
  11. Hi, Have got it now, it was all in a ? (question mark) RewriteCond %{QUERY_STRING} page=allnews RewriteRule ^index.php$ news.php? [R=301,L]
  12. Hi, I have the below rule to try and convert index.php?page=allnews&etc.. to news.php RewriteCond %{QUERY_STRING} page=allnews RewriteRule ^index.php$ news.php [R=301,L] The problem I am having is the URL changes to: news.php?page=allnews I am wanting to strip everything after news.php in the rule Can anyone help? Thanks
  13. Just thought I would come back with a follow up on this. It working fine. I didn't put SET in it, as I thought that was for update. But anyway it works great. Thank you very much
  14. Thanks for the reply I will give that code ago and if it doesn't work do a google on subqueries and/or derived tables. Thanks again
  15. Hi, I would like to do the following in PHP using a MySQL database, but not sure how. select a, b,c etc.. from mailbox where id = X then insert id,a,b,c etc.. into problem When I select, I will be calling the id So I would like it to get data from mailbox and then insert it into problem. How would I go about doing this? Thanks for any help you can give me
  16. Thanks Ken Thanks got it.
  17. Thanks for the reply. This is working to well $str = '0x.xx'; echo ltrim($str,'0'); Let say it is 00.00 I am wanting to remove the first 0 Then again it could be 01.00 I want to remove the first 0 Or it could be 10.00 which mean there is no 0 to remove The numbers could be anything.
  18. I have the first problem fixed. With it removing ,0 or ,1 by using $str2 = $newstring; $pattern2 = "{\,1||,0+}"; $newstring2 = preg_replace($pattern2,"",$str2); echo '<br>'; echo $newstring2; Now it just leaves removing the first 0 if it exists
  19. First problem fixed. My second problem is if the result is 0X.XX,0 or 0X.XX,1 I would like to remove the first 0 The X.XX are numbers, but the 0 is not always there. Can anyone help please Thanks
  20. Just going thought some old cold I had and I think I have found what I want. It seems to be working, but could someone check it over? $pages = array('/index.php','/',); if (in_array($_SERVER['SCRIPT_NAME'], $pages) && $_SESSION['UserId'] <= 0) { $t->display( 'homepage_NEW.tpl' ); } else { $t->display( 'index.tpl' ); }
  21. Hi, What I am after is If on index.php or http://www.domain.com and not logged on (got the bit of code for not logged on) Show not logged on template if logged in show logged in template This only a apply to the index.php page, all other pages have separate .php files So I am only wanting it so I know what template to show for the index.php page
  22. Hi, I would like to do the following but not sure how. If the you/user is on index.php of http://www.domain.com/ show one page If not show another How would I do this? Thanks
  23. That worked, great thanks for the help Will look at the /w later. Thanks agin for the help
  24. I tried with m modifer but I get the reverse problem
  25. Thanks for the reply, I have just tried this and I get the same problem.
×
×
  • 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.