PHP - How Can I Align Digit
Hi :-) How can I align digit as you can see in the screen shot.
<?php function MaFonction($x){ for ($i=0 ; $i<=360 ; $i+=$x){ echo $i . " ==> " . deg2rad($i) . "<br />"; } } ?> <?php MaFonction(15 ); ?>
Thank you ;-) Similar TutorialsThis for loop: for ($m = 01; $m <= 12; $m++) Will output: 1 2 3 4 etc. And NOT: 01 02 03 04 My question is: how can I make the number be 2 digits and have it output together with the ZERO? And when it's reaching the number 10 it should continue outputting: 10 11 12 And not 010 011 etc. I know this should be easy.... However, to validate a 7-digit phone number, I wrote this: Code: [Select] <?php if(!empty($_POST['mobile_number'])) { if(!is_numeric($_POST['mobile_number']) || strlen($_POST['mobile_number']) != 7) { $errors[] = 'Please enter a 7-digit number without spaces or dashes for your <strong>Mobile</strong>.'; } else { $_SESSION['mobile_number'] = $_POST['mobile_number']; } } else { $_SESSION['mobile_number'] = ''; } ... but now I realise that numeric/integer validation won't work because where I am - in Ireland - mobile numbers can start with an initial zero, too. So, the following mobile numbers are possible: 0123456 0224466 How can I ensure that: each digit in the mobile number is numeric an initial zero is possible there are exactly 7 digits I suppose I loop through each digit, ensuring that that digit is numeric and break out of the loop if a non-numeric digit is encountered..? Any suggestions? TIA Below is my code... I'm new to OOP so forgive me if it's poorly designed. What i'm trying to do is make sure that asset_key never get's duplicated. So when time comes to insert a new record, i can rest assures that asset_key will not duplicate. For some reason $random_number never get's back a value; Code: [Select] <?php class Randomize { function createRN() { $num = rand(100000,999999); $sql = "SELECT * FROM mer_asset_header WHERE asset_key = '$num'"; $go = oci_parse($conn, $sql); oci_execute($go); $count = oci_num_rows($go); if($count = 1) $repeat = Randomize::createRN(); else return $num; } } $random_number = new Randomize; $random_number->createRN(); ?> I should also mention, that if the query finds that asset_key, it should also run createRN() again untill it gets a unique one. Thanks for the help in advance! Hi, in Mysql have a row with FLOAT 10,2 In form put the number 20.20 and after reload in form show: 20.200000762939 Hey, If i have a string which contains numbers and symbols... such as 1:2:4 (its not always : for the symbol it changes) Is there a function that can convert the numbers that are 9 or less to have a 0 infront of them such as: 01:02:04 (also this is not timestamp format - just normal strings) This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=311051.0 Hi I am new to php, I am trying to capture the url and place into a variable but I only get the 1st digit to show, I just cant see what I am doing wrong. Sorry to ask such a basic question but I just can't work it out, I have attached a screen shot of all me code, your help would be very very much appreciated. How can I make sure that when I submit an new form and new ID (record) is created it is always 4-Digits. record 14 = 0014, record 225 = 0225. Thanks First of all, here's what i want it to look:' I just want that the related image must align towards left, and its information is just in front of it. But, what my code does is place the image on above line, and the information on the link below. Here's how it looks with my code. I will be able to make the changes with the File Information. The PHP which is being used is: 1. To fetch if preview is available: Code: [Select] $pre = ''; if ($prew==0) { if ($ext == 'bmp') $pre = 'Impossible Preview <br>'; if ($ext == 'gif' or $ext == 'jpeg' or $ext == 'jpg' or $ext == 'png' or $ext == 'JPG' or $ext == 'GIF' or $ext == 'PNG'or $ext == 'JPEG') $pre = '<img style="align:left;margin: 1px;" src="im.php?bab=1&id='.$file_info['id'].'" alt=""/>'; }2. To insert the preview image: Code: [Select] if($pre!=NULL) echo '<div class="block">'.$pre.'</div>'; 3. And finally the code to fetch file information: Code: [Select] echo '<div class="fileName"><a href="load.php?id='.$file_info[id].'"><font color="red">'.$file_info['name'].''.$extension.'</font></a>|'; if($ext =='txt') { echo '<a href="read.php?id='.$file_info['id'].'&id2='.$id.'"><font color="red">Read</font></a>';} echo $new_info.''; if(!empty($file_info['fastabout'])) echo str_replace("\n", '<br>',$file_info['fastabout']); echo '</div>'; echo '<tr><div class="t_block">'.$ico.'<a href="view.php?id='.$file_info[id].'"><strong>File Info</strong></a></div></tr></td>'; I just can't figure out what to insert with the code. I think it must be some table formatting (TR/TD), but because I'm a noob with PHP, I failed in all my attempts. Please, if anyone could help me out! I wish to display a text field with two buttons under it, and I want one of the button on the leftmost part (that’s very easy because that's the default), and the other on the rightmost part (this I don’t really know how to implement this). I am currently using something like this : <!DOCTYPE html> <html> <head> <title>Title</title> </head> <body> <fieldset> <input name="words" type="text" id="words" size="60" /><br><br> <input type="button" id="lb" name="leftbutton" value="leftbutton" /> <input type="button" id="rb" name="rightbutton" value="rightbutton" /> </fieldset> </body> </html> With this kind of code, I can adjust the number of to make the other button fit on the far right, but that’s obviously not the right way to do things. Perhaps I should use a table ? How ? Hi, When I post Arabic articles to my new blog, the alignment of text is like English so how can I align the text to be from right to left. as shown below: http://www.blog.aiwwan.com/ This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=326428.0 I've managed to upload .csv file, process it, and display output ... but I'm puzzled how to make it look nice so it can be exported (save as txt) say if I had a black page with a background or something simple and it had no content except for a link called "about us" and I wanted that link to be located at the bottom left side of the page but since it has no content its stuck up the top unless <br> or <p> is introduced. how could this be done without spamming <br /><p><br /> untill im happy with its location and if content is added it gets boosted down further with a massive gap >< Dear All, Hope all are fine. Need one hep to align the logo in the center of the footer. I tried align = Center but didn't help, please see below code ad advise. <div class="image"> <img src="images/icon/logo.jpg" alt="John Doe"/> </div>
Kind Regards, Naveed. Edited August 2, 2020 by Naveed786This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=358122.0 |