
cosmic_sniper
Members-
Posts
28 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Male
cosmic_sniper's Achievements

Newbie (1/5)
0
Reputation
-
Keeping Table Alignment when Pasting on Email
cosmic_sniper replied to cosmic_sniper's topic in HTML Help
colleyboy, or do you refer to PHPMailer? -
Keeping Table Alignment when Pasting on Email
cosmic_sniper replied to cosmic_sniper's topic in HTML Help
I'm not so familiar with CSS but I'm formatting the table using attributes on every HTML tag. You mean using include() as a body of mail()? Did I get it right? -
Keeping Table Alignment when Pasting on Email
cosmic_sniper replied to cosmic_sniper's topic in HTML Help
Thanks for the response. It's nice that you pointed that out but I think (I'm not sure though) that would be applicable only if I would encode the output directly on the email. What I'm looking for is some sort of code that would allow users to copy-paste the output as it is (with the alignment) or better yet, a code that would directly email the output. One option might be the use of mail() but if I got it right, using that, the body of the email could only contain up to 70 characters which is a great limitation on my part. -
thanks CPD for raising about filter_var I found it in another tutorial and I'm now studying about it.
-
Thanks for the advice. I tried this online sitemap generator wherein you just need to give the website and they would give you a download link for an xml file which you would upload into the root directory of your site. In that case, is it safe to say that the file is only good for the sitemap applicable during the time the xml file was generated and I have to generate another sitemap whenever I change factors concerning the link?
-
I was trying to index my website on Google and I came across "sitemap". To be honest, I've heard of the term before but don't really understand it. After conducting a few research I had better understanding of it and decided to create Sitemaps for my sites. The problem is I only know HTML (pretty good understanding) and PHP (on the process of studying). If I got it right, sitemap in accordance to sitemap protocol is created using XML. I came across one option, which is using third-party software. Do you think it's a good option? If so, then do you have any suggested software? Or should I really learn to create a sitemap manually? A little off-topic question: how long does it usually take for google to crawl into the site for it to see the keywords, etc. Thanks in advance!
-
If I got it right, type casting would force the system to understand that a certain string / variable is of a certain data type specified. As you've said it's not checking, per-se. Though it would be very helpful if I can make the form accept specific data types. If that would be the case, then there won't be a need for checking in the first place. lol ??? (completely puzzled) I'm sorry xyph but I really didn't get you there. I'm new to programming and self-studying, applying concepts as I learn them. Unfortunately, RegEx is about 8 lessons from where I am now. If it's not too much of a bother, could you help me construct that expression into if()? Finally, something I can work out with my current skills. Thanks for bringing this up but what is the function that I can use to check if the first character is "-"?
-
It seems that you designed your page for widescreen display. Though relatively few, there are still square monitors (like the one I'm using now). For such sites user experience should be put in the core of the design (I've learned from a Facebook developer.). Scrolling sideways is a bit inconvenient and may cause "one link to go down then another follows" (from The Social Network) So the bottom line is adjust page width to accommodate square monitors.
-
Nice work you have there! First thing that caught my attention was the button which says "Choose Music". So what got into my head was, "Hey, let me check some music." Then it turned out that it was to upload a music. I would suggest changing the terminology used. Make it "Upload Music" That would be it for now.
-
I am using that script to check for values entered on a form. Here's the code of the form: <html> <body> <form action="calc.php" method="post"> Date of transaction: <select name="month"> <option>-Month- <option>01 <option>02 <option>03 <option>04 <option>05 <option>06 <option>07 <option>08 <option>09 <option>10 <option>11 <option>12 </select> <select name="day"> <option>-Day- <option>01 <option>02 <option>03 <option>04 <option>05 <option>06 <option>07 <option>08 <option>09 <option>10 <option>11 <option>12 <option>13 <option>14 <option>15 <option>16 <option>17 <option>18 <option>19 <option>20 <option>21 <option>22 <option>23 <option>24 <option>25 <option>26 <option>27 <option>28 <option>29 <option>30 <option>31 </select> Time:<select name="hr"> <option>-hr- <option>01 <option>02 <option>03 <option>04 <option>05 <option>06 <option>07 <option>08 <option>09 <option>10 <option>11 <option>12 </select> <select name="min"> <option>-min- <option>00 <option>01 <option>02 <option>03 <option>04 <option>05 <option>06 <option>07 <option>08 <option>09 <option>10 <option>11 <option>12 <option>13 <option>14 <option>15 <option>16 <option>17 <option>18 <option>19 <option>20 <option>21 <option>22 <option>23 <option>24 <option>25 <option>26 <option>27 <option>28 <option>29 <option>30 <option>31 <option>32 <option>33 <option>34 <option>35 <option>36 <option>37 <option>38 <option>39 <option>40 <option>41 <option>42 <option>43 <option>44 <option>45 <option>46 <option>47 <option>48 <option>49 <option>50 <option>51 <option>52 <option>53 <option>54 <option>55 <option>56 <option>57 <option>58 <option>59 </select> <br> Type of transaction: Buy<input type="radio" name="transaction" value="buy">Sell<input type="radio" name="transaction" value="sell"><br> Stock symbol:<input type="text" name="stock">(e.g. AB, SCC, ABS)<br> Book value of stock:<input type="text" name="BV">(<i><b>*For selling transaction only</b></i>)<br> Price per share:<input type="text" name="price"><br> Volume of shares:<input type="text" name="volume"><br> <input type="submit"> </form> Here are the things I want to check: Are necessary fields filled out? Did the user enter the proper data type? I'm almost done with the first item. The only thing left is to check for the date and time section. I guess (please correct me if I'm wrong), the following code would check if the data passed is a number and not the default "-day-" or "-hr-" <?php if ($month >= 0 && $day >= 0 && $hr >= 0 && $min >= 0) { $checkpoint = 'false'; } else { echo '<font color="#FF0000">Date and time is not properly set.</font>'. '<br />'; $checkpoint = 'true'; } ?> For the second bullet for checking, what code can check if the data entered is a float for field that requires it or long for field that requires it?
-
I finally got it to work by introducing a new variable. Thanks as well for the comments since it somehow helped me arrive at the solution. Here's the code: <?php // checking of variables if (!isset($transaction)) { echo '<font color="#FF0000">Type of transaction is not set.</font>'. '<br />'; $checkpoint = "true"; } else { if ($transaction == 'sell') { if (empty($BV)) { echo '<font color="#FF0000">Book value is not set.</font>'. '<br />'; $checkpoint = "true"; } } } if (empty($stock)) { echo '<font color="#FF0000">Stock symbol is not set.</font>'. '<br />'; $checkpoint = "true"; } if (empty($price)) { echo '<font color="#FF0000">Price per share is not set.</font>'. '<br />'; $checkpoint = "true"; } if (empty($volume)) { echo '<font color="#FF0000">Volume of shares is not set.</font>'. '<br />'; $checkpoint = "true"; } if ($checkpoint == "true") { echo '<br /><br /> Go back and fill out necessary fields.'; } else { echo 'Copy and paste the following in the email that you would be submitting.'. '<br /><br />'; switch ($transaction) { case 'buy': include('calc_buy.php'); break; case 'sell': include('calc_sell.php'); break; default: echo '<font color="#FF0000"><b>If you see this message there is something wrong with your session. Please send us a feedback with the details of your session before seeing this message.</b></font>'; } } ?> This is already working. Though, there is still another problem regarding checking of values. I'll post it in my next reply. Edit: Included <?php ?> on code.
-
I do understand that the way I used if() in that code is wrong. If I got it right, the way it should be nested is something like this: if (condition_a) { if (condition_b) { echo 'condition_a and condition_b are TRUE'; } else (condition_c) { echo 'condition_a and condition_c are TRUE'; } } elseif (condition_d) { echo 'condition_a is FALSE and condition_d is TRUE'; } elseif (condition_e) { echo 'condition_a and condition_d are FALSE and condition_e is TRUE'; } else { echo 'condition_a, condition_d, and condition_e is FALSE'; } ?> I'll explain it from the start and how I came up with that code. What I wanted is to check for certain conditions, then if any of those returned TRUE, echo something then end the program. If none of the conditions are true, continue with the next section. With the structure of if...elseif...else(), I can only check for one condition that is TRUE. For nested if(), like the case of condition_b & c, I can only check for them if a is correct. So, to check all the conditions, I used a series of if(). (checking successful ) Here's the problem. With such code (series of if()), even the conditions returned TRUE, the succeeding section would still execute. That's how I came up with if( if() { //code } if() { //code } if() { //code } } { else { //code } Now I know that it would not work. Any suggestion for alternative ways to do it?
-
I would like to have a script that would check certain parameters and if none of them returns TRUE, execute a set of codes. So the idea is somehow like if...else(). <?php // trying to put if() directly within if() if ( // checking of variables if (!isset($transaction)) { echo '<font color="#FF0000">Type of transaction is not set.</font>'. '<br />'; } else { if ($transaction == 'sell') { if (empty($BV)) { echo '<font color="#FF0000">Book value is not set.</font>'. '<br />'; } } } if (empty($stock)) { echo '<font color="#FF0000">Stock symbol is not set.</font>'. '<br />'; } if (empty($price)) { echo '<font color="#FF0000">Price per share is not set.</font>'. '<br />'; } if (empty($volume)) { echo '<font color="#FF0000">Volume of shares is not set.</font>'. '<br />'; } ) { echo 'Go back and fill out necessary fields.'; } // if none of the above parameters returns TRUE else { echo 'Copy and paste the following in the email that you would be submitting.' </tr> <tr> <td> switch ($transaction) { case 'buy': include('calc_buy.php'); break; case 'sell': include('calc_sell.php'); break; default: echo '<font color="#FF0000"><b>If you see this message there is something wrong with your session. Please send us a feedback with the details of your session before seeing this message.</b></font>'; } } ?> This code returns an error and as I understand the error, it is because of if (if ()). How can I make it work? Thanks in advance!
-
Thanks it worked! Though, I made a little tweaking in able to incorporate number_format() that I need. <?php if($CG < 0) { $CG *= -1; echo "(". number_format($CG, 2, '.', ','). ")"; } else { echo number_format($CG, 2, '.', ','); } ?>
-
Aside from money_format(), is there another way to use "()" instead of "-" for negative numbers? Actually, using money_format() would be best for me but I've read somewhere that list of locale differ from server to server. Unfortunately, I cannot identify the list of locale supported on the server I'm using (Heliohost) since system('locale -a') is disabled. Thanks in advance!