PHP - Merging File Help
I am new to php. I have been at this for 8 hours and I am not getting anywhere.
The objective is to convert the 4-file html/php application into a 1-file php application and generate exactly the same answers and look as the original. I also attached the files. Code: [Select] step1.html: <html> <head><title>STEP1</title><link rel="stylesheet" type="text/css" href="steps.css" /></head> <body> <div class="block"> <form action="step2.php" method="post"> ENTER INPUT1(A or B): <select name="input1"> <option>A</option> <option>B</option> </select> <input type="submit" value="ENTER"/> </form> </div></body></html> step2.php <html> <head><title>STEP2</title><link rel="stylesheet" type="text/css" href="steps.css" /></head> <body> <div class="block"> <?php $choice=$_POST["input1"]; if($choice=="A") { echo "<form action='step4.php' method='post'>"; echo "<input type='hidden' name='input1' value='5'/>"; } else if($choice=="B") { echo "<form action='step3.php' method='post'>"; echo "<input type='hidden' name='input1' value='1'/>"; } else { echo "<form action='step1.html' method='post'>"; } ?> ENTER INPUT2(1-10) : <input type='text' name='input2' size='3'> <input type="submit" value="ENTER"/> </form> </div></body></html> step3.php: <html> <head><title>STEP3</title><link rel="stylesheet" type="text/css" href="steps.css" /></head> <body> <div class="block"> <?php $x="1"+$_POST["input1"]; $y="1"+$_POST["input2"]; $z=(int)$x+(int)$y+2; echo "<div class='output'>OUTPUT: "; if($y<=15) { echo "$z.$y.$x";} else { echo "$x.$y.$z";} echo "</div>"; ?> <div class="note">MAKE SURE TO COPY/WRITE THE OUTPUT</div> <a href="step1.html">RESTART</a> </div></body></html> step4.php: <html> <head><title>STEP4</title><link rel="stylesheet" type="text/css" href="steps.css" /></head> <body> <div class="block"> <?php $xf="1"+$_POST["input1"]; $xz="2"+$_POST["input2"]; $xaq=(int)$xf; $xax=(int)$xz; if($xaq>$xax) {$xaq=$xaq+33;$xax=$xax+31;} else {$xaq=$xaq+2;$xax=$xax+44;} echo "<div class='output'>OUTPUT: "; echo "$xf.$xaq.$xax.$xz"; echo "</div>"; ?> <div class="note">NOTE: MAKE SURE TO COPY/WRITE THE OUTPUT</div> <a href="step1.html">RESTART</a> </div></body></html> [attachment deleted by admin] Similar TutorialsI currently have a flat file user registration and login in system. I also have a simple guestbook which i didn't code myself, the guest book currently requires the user to type in there name and e-mail address to make a post. how ever i would like them to have to login and if they aren't logged in then don't display the guestbook. Live version: B50crew.co.uk Guestbook.php: Code: [Select] <?php // find out the domain: $domain = $_SERVER['HTTP_HOST']; // find out the path to the current file: $path = $_SERVER['SCRIPT_NAME']; $url = "http://" . $domain . $path ; extract($_POST); if($Submit){ $date = date('D d Y h:i'); $comment=eregi_replace("\r\n","*",$comment); $comment=eregi_replace("\n","*",$comment); $fp = fopen("bin/guestbook.nfo","a+"); if(!$fp) { echo 'Error: Cannot open file.'; exit; } fwrite($fp, $date."||".$name."||".$email."||".$comment."\n"); fclose($fp); } ?> <div align="center"> <h2><span class="style1">Guestbook </span><br> </h2> </div> <form name="form1" method="post" action="<?php echo $url;?>"> <label>Name <input type="text" name="name"> </label> <label>Email <input type="text" name="email"> </label> <p> </p> <p> comment<br> <textarea name="comment" cols="40" rows="10"></textarea> <br> <label> <input type="submit" name="Submit" value="Sign"> </label> <br> </p> </form> <hr> <?php $userinfo = file("cgi-bin/guestbook.nfo"); echo '<table border="0">'; foreach($userinfo as $val) { //explode that data into a new array: $data = explode("||", $val); echo '<tr><td>'.$data[0].'</td></tr>'; echo '<tr><td>'.$data[1].' Wrote:</td></tr>'; $data[3]=eregi_replace("\*","<br>",$data[3]); echo '<tr><td>'.$data[3].'</td></tr>'; echo '<tr><td>Email:'.$data[2].'<hr></td></tr>'; } echo '</table>'; ?> Login: Code: [Select] <?php // find out the domain: $domain = $_SERVER['HTTP_HOST']; // find out the path to the current file: $path = $_SERVER['SCRIPT_NAME']; $url = "http://" . $domain . $path ; extract($_POST); if($Submit){ $date = date('D d Y h:i'); $comment=eregi_replace("\r\n","*",$comment); $comment=eregi_replace("\n","*",$comment); $fp = fopen("bin/guestbook.nfo","a+"); if(!$fp) { echo 'Error: Cannot open file.'; exit; } fwrite($fp, $date."||".$name."||".$email."||".$comment."\n"); fclose($fp); } ?> <div align="center"> <h2><span class="style1">Guestbook </span><br> </h2> </div> <form name="form1" method="post" action="<?php echo $url;?>"> <label>Name <input type="text" name="name"> </label> <label>Email <input type="text" name="email"> </label> <p> </p> <p> comment<br> <textarea name="comment" cols="40" rows="10"></textarea> <br> <label> <input type="submit" name="Submit" value="Sign"> </label> <br> </p> </form> <hr> <?php $userinfo = file("cgi-bin/guestbook.nfo"); echo '<table border="0">'; foreach($userinfo as $val) { //explode that data into a new array: $data = explode("||", $val); echo '<tr><td>'.$data[0].'</td></tr>'; echo '<tr><td>'.$data[1].' Wrote:</td></tr>'; $data[3]=eregi_replace("\*","<br>",$data[3]); echo '<tr><td>'.$data[3].'</td></tr>'; echo '<tr><td>Email:'.$data[2].'<hr></td></tr>'; } echo '</table>'; ?> Session.php <?php class user { var $file_dir = ""; function start($time = 3600) { session_set_cookie_params($time , ''); session_name('afroxav-login'); session_start(); // Reset the expiration time upon page load if (isset($_COOKIE['afroxav-login'])) { setcookie('afroxav-login', $_COOKIE['afroxav-login'], time() + $time, '', 'localhost', 0, 1); } if (!isset($_SESSION['info'])) { $this->data = array('name' => 'Anonymous', 'logged' => false); } else { $this->data = $_SESSION['info']; } } function check_login() { if ($this->data['logged'] !== true) { return false; } else if ($this->data['logged'] === true) { if ($this->data['name'] !== 'Anonymous') { return true; } return false; } return false; } function login($user, $pass) { $logins_raw = @file_get_contents($this->file_dir . 'users.php'); $logins_processed = str_replace('<?php exit; ?>', '', $logins_raw); $logins_array = explode('\n', $logins_processed); foreach ($logins_array as $id => $line) { $logins[$id] = explode('|', $line); } $pass = $this->hash_pass($pass); foreach ($logins as $user_info) { if ($user_info[1] == $user) { if ($user_info[2] == $pass) { $this->update_session($user_info); return true; } } } return false; } function hash_pass($string) { return hash('sha512', $string); } function logout() { $_SESSION['info'] = array('name' => 'Anonymous', 'logged' => false); $this->data = $_SESSION['info']; return true; } function prep_reg_array($name, $pass, $email, $mod = 'false', $admin = 'false') { $id_raw = @file_get_contents($this->file_dir . 'id.php'); $id = str_replace('<?php exit; ?>', '', $id_raw); $id = $id + 1; @file_put_contents($this->file_dir . 'id.php', '<?php exit; ?>' . $id); return array($id, $name, $this->hash_pass($pass), $email, $mod, $admin); } function register($userdata) { $write = file_put_contents($this->file_dir . 'users.php', '\n' . implode('|', $userdata), FILE_APPEND); return ($write !== false) ? true : false; } function update_session($array) { $_SESSION['info'] = array( 'id' => $array[0], 'name' => $array[1], 'pass' => $array[2], 'email' => $array[3], 'mod' => $array[4], 'admin' => $array[5], 'logged' => true ); $this->data = $_SESSION['info']; } }; //html related functions //not related at all with the sessions function html_start($title) { header('Content-type: text/html'); echo "<html>\n"; echo "<head>\n"; echo "<title>\n"; echo $title; echo "</title>\n"; echo "</head>\n"; echo "<body>\n"; echo "<h1>\n"; echo $title; echo "</h1>\n"; } function html_nav() { global $user; echo "<div>\n"; echo "Navigation\n"; echo "<ul>\n"; echo "<li><a href=\"?page=home\">Home</a></li>\n"; if ($user->check_login() == true) { echo "<li><a href=\"?page=logout\">Log Out</a></li>\n"; } else { echo "<li><a href=\"?page=login\">Log In</a></li>\n"; echo "<li><a href=\"?page=register\">Register</a></li>\n"; } echo "</ul>\n"; echo "</div>\n"; } function html_end() { echo "</body>\n"; echo "</html>\n"; } ?> Hi there, I am using HTML forms to post values from a data entry page. When they arrive on the second page - I have to extract them from the POST array. This is fine, but I now have to merge them somehow. When I use print_r to view the POSTed data, I see: Code: [Select] [namesUnem] => Array ( [0] => Brian [1] => Richard [2] => Sarah ) [commentsUnem] => Array ( [0] => Brian Comments here [1] => Richard Comments should be entered here [2] => Sarah's Comments were also entered here ) [namesHW] => Array ( [0] => Sally [1] => Kate [2] => William ) [commentsHW] => Array ( [0] => Sally Comments here [1] => Kate's Comments should be entered here [2] => William's' Comments were also entered here ) There are 2 more such arrays being POSTed. I would need to merge in order to see the following: Quote [Name] => Brian [Comment] => Brian Comments here [Type] => namesUnem [Name] => Richard [Comment] => Richard Comments should be entered here [Type] => namesUnem [Name] => Sarah [Comment] => Sarah's Comments were also entered here [Type] => namesUnem [Name] => Sally [Comment] => Sally Comments here [Type] => namesHW [Name] => Kate [Comment] => Kate's Comments should be entered here [Type] => namesHW [Name] => William [Comment] => William's' Comments were also entered here [Type] => namesHW Any help greatly appreciated Kindest Regards AikenD This must be easy enough, but I'm a noob so go easy on me, please :-)
I have two pieces of code and they're working well on their own. All I need is to put these two conditions into one query.
The first one:
<?php function childtheme_cat_limited_blog( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( 'events_categories', 'mycategory1' ); } } add_action( 'pre_get_posts', 'childtheme_cat_limited_blog' ); ?>And the second: <?php function childtheme_cat_limited_blog( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( 'category_name', 'mycategory2' ); } } add_action( 'pre_get_posts', 'childtheme_cat_limited_blog' ); ?>I'm sure it's a piece a cake for you guys, but I can't figure it out for the life of me, so any help would be greatly appreciated! Thank you! (My goal is here to display posts from two categories on a homepage of a Wordpress site, but to complicate things the two categories are from two different post types.) What I'm looking to do is analyze an array of coordinates and generate a convex-hull type outline of all independent polygons merged. Convex hull isn't ideal for my situation as I need the outline detailed. From: To: This is how the data is arranged (The keys are just for reference): $array['Group_01']['Polygon_01'] = array('latitude, longitude', 'latitude, longitude', 'latitude, longitude', etc.); $array['Group_01']['Polygon_02'] = array('latitude, longitude', 'latitude, longitude', 'latitude, longitude', etc.); $array['Group_01']['Polygon_03'] = array('latitude, longitude', 'latitude, longitude', 'latitude, longitude', etc.); $array['Group_02']['Polygon_01'] = array('latitude, longitude', 'latitude, longitude', 'latitude, longitude', etc.); $array['Group_02']['Polygon_02'] = array('latitude, longitude', 'latitude, longitude', 'latitude, longitude', etc.); etc. Basically in that scenario I would like to join ALL of the coordinates to form an outline in both 'Group_01' and 'Group_02' based on the polygons in 'Polygon_xx' under that group. Each outline independent of itself. So 'Group_01' would be a union of $array['Group_01']['Polygon_01'], $array['Group_01']['Polygon_02'], and $array['Group_01']['Polygon_03']. Then 'Group_02' would be a union of $array['Group_02']['Polygon_01'] and $array['Group_02']['Polygon_02']. This would output an array of something like $array['Group_01']['Unified'] and $array['Group_02']['Unified'] etc. Is this possible? Any help would be greatly appreciated. Thanks. Hello. I'm currently trying to write a code to merge two separate images together, but for the life of me I can't find anything that works. Basically what I'm trying to do is add a "marking" (cat_stripes.png) to a pet image (cat.png). In the future I also want to use this for adding items to pets and things like that. Both of the images have transparent backgrounds, so that needs to be taken into account. If you haven't got a clue what I'm talking about, look up Wajas or similar virtual pet sites to get an idea of how the markings work. I just need something simple, since I don't have a site set up yet and I'm just testing some things out for a future project. I don't have any codes at the moment, since nothing has worked so far. I'm pretty new to GD too (I'm familiar with all the basic php stuff, so don't panic), so you might need to explain some of the more advanced stuff to me. Any help with this would be really appreciated, thanks. (: When i upload photos and the name of the photo i would like to be able to overlay a portion of the original photo with another image already in the site directory, and also add the photos name over the top of the overlayed image, i may have explained this in a confusing way so i have attached an example. Is this something that can be done using something like GD or imagick, if so could someone please give me a good place to start. $query = "SELECT Table1.*, Table2.A, Table2.B, Table2.C, Table2.D, Table2.E FROM Table1 INNER JOIN Table2 ON Table1.A = Table2.A Issue is that there are multiple matches for some instances, like so: Table1.A value = 1777 (only once since it is a UniqueID) Table2.A value = 1777 (3 records with this ID value) So I will get 3 records returned since Table1.A matches 3 records in Table2.A. I want to merge the 3 records in Table2 into 1 record and then match that with Table1 where the UniqueID is the same. Make sense? Hey! I have a bunch of text files with one line of text ex. SHS9GW34 I'm trying to write a little php script on my local machine that will take all the files and put all the different codes in the same files in this kind of format: RGDGIDSG453 EOHBDSBN453 ERGD4535355 etc etc Thanks Hello guys, I don't really know php but I am always been able to copy/paste it and move stuff around on my wordpress website until now. This last challenge is beyond my skills though (I am sure it will be trivial for you). So I have this code snippet to show a video duration <?php global $post; $video = cbc_get_video_data( $post ); if( $video ) { echo $video->get_human_duration(); } ?> And I have this code to show a post title if ($show_title) { $title_content .= apply_filters( 'uncode_before_body_title', '' ); $title_content .= '<div class="post-title-wrapper"><h1 class="post-title">' . get_the_title() . '</h1>'; $title_content .= uncode_post_info() . '</div>'; $title_content .= apply_filters( 'uncode_after_body_title', '' ); } I want to show the video duration right before the post title and in line with it, so inside the h1 tag. How to do that? Thanks for any help!
Hi wondering if there's a simple way to merge or update the data from one array to another . I've tried merge data but it just adds additional records rather than merging them off one common key.
The array is just simply adding a name to another array the format of both is as follows
Array 1
[0] => stdClass Object ( [name] => [market] => Football [selection] => 7051575 ) ) Array 2 Array ( [0] => stdClass Object ( [name] => Something [market] => [selection] => 7051575 ) ) There are other fields but I'm just trying to merge the name from Array two into Array one using the selection as a common key. Is there an easy command like merge or do I have to loop thru the arrays to add the data. Thanks Hi,
I'm trying to combine two images - an uploaded image and a permanent. First I try to resize them to the same dimensions. Why I resize the uploaded image to the dimensions of permanent, everything works fine. But when I do the opposite, the images just don't merge, and the output is just the permanent image with resized dimensions. Anyone knows why?
Here is my code:
<?php if( isset( $_FILES['image'] ) ){ $desired_width = 360; $desired_height = 360; $layers = array(); switch($_FILES['image']['type']){ case "image/jpeg": $source_image = imagecreatefromjpeg($_FILES['image']['tmp_name']); break; case "image/gif": $source_image = imagecreatefromgif($_FILES['image']['tmp_name']); break; case "image/png": $source_image = imagecreatefrompng($_FILES['image']['tmp_name']); break; } $frame = imagecreatefrompng("1.png"); $desired_width = imagesx($source_image); $desired_height = imagesy($source_image); $virtual_image = imagecreatetruecolor($desired_width, $desired_height); imagecopyresampled($virtual_image, $frame, 0, 0, 0, 0, $desired_width, $desired_height, 360, 360); $layers = array($source_image,$virtual_image); $image = imagecreatetruecolor($desired_width, $desired_height); // to make background transparent imagealphablending($image, false); $transparency = imagecolorallocatealpha($image, 0, 0, 0, 127); imagefill($image, 0, 0, $transparency); imagesavealpha($image, true); imagealphablending($image, true); for ($i = 0; $i < count($layers); $i++) { imagecopy($image, $layers[$i], 0, 0, 0, 0, $desired_width, $desired_height); } imagealphablending($image, false); imagesavealpha($image, true); header('Content-type: image/png'); header('Content-Disposition: attachment; filename="new_profile.png"'); imagepng($image); } ?> I have tried many solution, but nothing seems to fix this. The problem is that i put an image with transparency on top of another image, but the transparent pixels still transparent, where they should show some of the image below it. If you call it with l=100 and p=20 i would get this result http://cl.ly/566Z instead of this http://cl.ly/56OF. Here is the source code and I have attached the images: Code: [Select] <?php header('Content-type: image/png'); echo imagepng(progressbar($_GET['l'], $_GET['p'])); function progressbar($length, $percentage) { $length = round($length / 2) * 2; $percentage = min(100, max(0, $percentage)); if($length > 0) { $bar = imagecreate($length, 14); imagealphablending($bar, false); imagesavealpha($bar, true); $empty = imagecreatefrompng('Empty.png'); imagealphablending($empty, false); imagesavealpha($empty, true); $fill = imagecreatefrompng('Fill.png'); imagealphablending($fill, false); imagesavealpha($fill, true); $lempty = imagecreatefrompng('LeftEmpty.png'); imagealphablending($lempty, false); imagesavealpha($lempty, true); $lfill = imagecreatefrompng('LeftFill.png'); imagealphablending($lfill, false); imagesavealpha($lfill, true); $rempty = imagecreatefrompng('RightEmpty.png'); imagealphablending($rempty, false); imagesavealpha($rempty, true); $rfill = imagecreatefrompng('RightFill.png'); imagealphablending($rfill, false); imagesavealpha($rfill, true); $emptycaplength = min(7, $length / 2); //5 imagecopy($bar, $lempty, 0, 0, 0, 0, $emptycaplength, 14); imagecopy($bar, $rempty, $length - $emptycaplength, 0, 7 - $emptycaplength, 0, $emptycaplength, 14); if($length > 14) { imagecopyresized($bar, $empty, 7, 0, 0, 0, $length - 14, 14, 1, 14); } $filllength = round(($length * ($percentage / 100)) / 2) * 2; $fillcaplength = min(7, $filllength / 2); imagecopy($bar, $lfill, 0, 0, 0, 0, $fillcaplength, 14); imagecopy($bar, $rfill, $filllength - $fillcaplength, 0, 7 - $fillcaplength, 0, $fillcaplength, 14); if($filllength > 14) { imagecopyresized($bar, $fill, 7, 0, 0, 0, $filllength - 14, 14, 1, 14); } imagealphablending($bar, true); return $bar; } else { return false; } } ?> Hello, I want to 'join' two corresponding array values together as in the example below. $one = array('tomato', 'ham', 'bacon'); $two = array('soup', 'sandwich', 'roll'); $final=array(?) //Desired answer = (tomatosoup, hamsandwich, baconroll) Is there a php function that can do this, or a series of functions? I am aware of array_merge but this only alternates the values from what I can see. Ideally there should be a check performed that the two are the same length before completing a merge. New to this, many thanks! Hi guys,
I wonder if you can offer any advice?
I have two user database tables that are about 70% identical. The problem is that with one of them, the phone number for each user has been cut short by two digits (it was an error on my part early on in the database design).
What I need to do is to get the values from both tables and put them into separate arrays then compare the arrays in a loop. If, say, the first five digits of the phone number in each row of the first table match one entry in the second table then update the second table with the phone number (the full length one).
I'm about puzzled about how to approach this, I've still got a lot to learn about array functions, it seems like it should be fairly simple but I'm a bit lost as to where to begin.
Any advice would be massively appreciated!
how to get the name of the file including a file from the included file, This one has me mixed up a bit.. I am trying to record site activity information from a common.php file using a user object. But since the file is included into different php files based on different situations I need a dynamic way of finding the file name that is including it. I could be over complicating things but right now this seems like the best solution other wise I'll have to rewrite the code on every page i write. Is there a function for doing this? Or if someone gets what I'm trying to do if they could point me to the direction of some more information on it. Thanks. In this multi file upload form, choose three images, click submit and preview the images on the preview page. If the user wishes to delete or replace an image, click edit and the form will go back to the previous page. Select the replace radio button for example on one of the three images and select a new image from the file input prompt and click submit. The form will go to the preview page again to display the images. During this process the image names are being input into a table and the images are being moved to a directory. The table is `id` AUTO_INCREMENT, `image0` `image1` `image2` `status` So input name='image[image0]' can be directed to table `image0` and so on. The code for keep and delete work fine, but how do I replace an image? I have two foreach blocks. The first one deletes the image file from the directory and deletes the image name from the table, but the second foreach dose not move the new image file into the directory. Thanks. <input type='radio' name='image[image0]' value='keep' checked='checked'/> <input type='radio' name='image[image0]' value='delete' /> <input type='radio' name='image[image0]' value='replace' /> <input type="file" name="image[]" /> <input type='radio' name='image[image1]' value='keep' checked='checked'/> <input type='radio' name='image[image1]' value='delete' /> <input type='radio' name='image[image1]' value='replace' /> <input type="file" name="image[]" /> <input type='radio' name='image[image2]' value='keep' checked='checked'/> <input type='radio' name='image[image2]' value='delete' /> <input type='radio' name='image[image2]' value='replace' /> <input type="file" name="image[]" /> <?php if (isset($_POST['status'])) { $status = $_POST['status']; $confirm_code = $status; #--------------------------- replace -------------------------------------------- if (isset($_POST['submitted']) && ($image = $_POST['image'])) { foreach($image as $imageKey => $imageValue) { if ($imageValue == 'replace') { $query = "SELECT $imageKey FROM table WHERE status = '$status' "; if($result = $db->query( $query )){ $row = $result->fetch_array(); } unlink( UPLOAD_DIR.$row[0] ); $query = "UPDATE table SET $imageKey = '' WHERE status = '$status' "; } } foreach($image as $imageKey => $imageValue) { if ($imageValue == 'replace') { $filenm = $_FILES['image']['name']; $file = $_FILES['image']['tmp_name']; move_uploaded_file($file, UPLOAD_DIR . $filenm); $filename[] = $filenm; $query = "INSERT INTO table VALUES ('','$filename[0]','$filename[1]','$filename[2]','$confirm_code')"; } } } } ?> Hiya, Firstly, I'm a complete novice, apologies! But I have got my upload.php working which is nice. I will post the code below. However, I would now like to restrict the file size and file type to only word documents. I currently have a restriction of 200KB but it's not working - no idea why as I've looked at other similar codes and they look the same. Also, just to complicate things - can I stop files overwriting each other when uploaded? At the moment, if 2 people upload files with the same name one will overwrite the other. Is this too many questions in 1? Any help is very much appreciated! Code below: Code: [Select] <form enctype="multipart/form-data" action="careers.php" method="POST"> Please choose a file: <input name="uploaded" type="file" /><br /> <input type="submit" value="Upload" /> </form> <?php $target = "upload/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; //This is our size condition if ($uploaded_size > 200) { echo "Your file is too large.<br>"; $ok=0; } //This is our limit file type condition if ($uploaded_type =="text/php") { echo "No PHP files<br>"; $ok=0; } //Here we check that $ok was not set to 0 by an error if ($ok==0) { Echo "Sorry your file was not uploaded"; } //If everything is ok we try to upload it else { if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "Your file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded."; } else { echo "Sorry, there was a problem uploading your file."; } } ?> Hey everyone, I'm pretty new to this, not my full time job, but just something I thought I'd give a shot... I have a database, in postgres, in which I make my query and I go fetch all the info I need. What I need to do next is the tricky part for me. For each line of results received, I have to output to a text file (.txt) but I have to respect a format that was given to me from the person requesting the info. Example: Character 1 must be G or N. Character 2 to to 11 will be a result from my database search, which is a 10 digit string. Character 12 to 14 must be spaces. Another rule is: start at character 78: input a value from my database search but it must not exceed 20 characters and if it is less then 20 character, fill the remaining with spaces. If anyways has a code I can copy and work off of I would really appreciate it....thanks! I'm using an Upload Script, and I've been working on trying to style the 'Choose File Button' (input file button) |