PHP - Temporary Place Holder, Incremental Organization
I have this interesting problem, I think I know how to do it.
In a java class I took there was a lab on swapping the values of variables and if there were two variables, you needed a third temporary value holder.
So this project I'm working on has a row output, currently the individual values are outputted as a concatenated string but ideally they would be independent rows with accompanying buttons.
One of those buttons is a ^ symbol, when you press this, ideally the row is moved up in ID putting the previous ID in front or ahead.
The problem is that the ID's / rows are not necessarily in sequential order.
So, when I recall a set of rows that have random sequential values for example, 2, 5, 27, 41, 43
and those are outputted by themselves, now becoming 0,1,2,3,4 respectively or 1,2,3,4,5
So when I try to move 43 to position 2, that's 4 positions away or 4 clicks of the ^ button.
Now how do you deal with that 4 difference and the difference of 41... ? thereby, when the initial set of rows are recalled again, the order is now, 43, 5, 27, 41, 2 Of course the ID I think remains the same but the data is switched... ? yeah I have to draw some pictures, but this isn't a current problem to fix, later on down the road after I update the interface.
here is a drawing to explain, I'm more of a visual person
wp_20150112_05_27_16_pro.jpg 59.67KB
0 downloads
Any ideas would be appreciated, otherwise I will post my solution when I come to it. Or I don't figure it out and find one.
thanks
Similar TutorialsHi everyone. In the script below, I would like to have the input box for "Website" to have http:// already in that input field. So, people will see "Website:" and then in the input field it will have "http://" I'm a PHP novice, and I'm not sure how to do it. Thanks. Code: [Select] <?php $contact_form_fields = array( array('name' => 'Website:', 'type' => 'input', 'require' => 1), array('name' => 'Name:', 'type' => 'name', 'require' => 1), array('name' => 'E-mail:', 'type' => 'email', 'require' => 1), array('name' => 'Phone:', 'type' => 'input', 'require' => 0), array('name' => 'Service:', 'type' => 'select', 'require' => 1, 'default' => 'Select Desired Service', 'items' => array('Keyword Research', 'Search Engine Optimization', 'Link Building Services', 'SEO Web Design', 'SEO Copywriting', 'SEO Consulting', 'Conversion Optimization', 'Social Media and PR', 'Landing Page Optimization', 'Other')), array('name' => 'Budget:', 'type' => 'select', 'require' => 1, 'default' => 'Budget / Monthly', 'items' => array('$500-$1500', '$1500-$2500', '$2500-$5000', '$5000-$10000', '$10K +')), array('name' => 'Comments:', 'type' => 'textarea', 'require' => 1), array('name' => 'Turing number:', 'type' => 'turing', 'require' => 1, 'url' => 'contact-form/image.php', 'prompt' => 'Please enter the number displayed above'), ); $contact_form_graph = false; $contact_form_xhtml = true; $contact_form_email = "someone@somewhere.com"; $contact_form_encoding = "utf-8"; $contact_form_default_subject = "Sent from free SEO quote form"; $contact_form_message_prefix = "Sent from free SEO quote form\r\n==============================\r\n\r\n"; include_once "contact-form2/contact-form/contact-form.php"; ?> I've made several classes which pertain to product information. They are as such: 1) class.Product.php 2) class.WineProduct.php 3) class.ProductReview.php 4) class.ProductAward.php Currently class.WineProduct.php extends class.Product.php; ProductReview and ProductAward are just included in the Product class - this I know is wrong because when I try to run a function from within that class I get the error: Quote Cannot access parent:: when current class scope has no parent Here's a sample of the offending code: Code: [Select] $wine = new WineProduct(); $wine->AddAward('Gold'); // This is the bad line: foreach($wine->awards as $awd) $awd->SaveToDB(); The SaveToDB function uses parent::barcode in an SQL query. The barcode is a property of the Product class. I know this has something to do with the include() statements...but what SHOULD I have done? Hello, Please could someone tell me how to retrieve an incremental variable from MYSQL as soon as it is inserted? (i.e. before another variable can be inserted) Many thanks. Stu I have an array of data in which I want to display in a table with the first row of data to not be formatted. In the second row of data, I want it formatted with the CSS class of "success". When I run this code, I do not get any formatting of any rows in the table. I have tried various different options without success. Any help would be greatly appreciated.
<?php Copied wrong set of code This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=345265.0 My users table on my forum is what gets checked everytime a user refreshes to authentic them.
When killing a monster, I want users to be able to grab items and it will insert them into their inventory. I have this part done already. But I want them to have a plethora of loot available that drops from a mob, and once they click the specific item it will then be inserted into their inventory (server database).
I'm storing the Temporary Item Data in a PHP session variable. Once they kill a monster, the Tempory Item Data variable get's filled with the specific loot and then the user will have the option to choose what items they want to go into their inventory.
My problem is, if they open the game in a new browser they will get a new session id. Since I'm authenticating them through my users table, can I just make a new column called session_id and just use php's session_id() before every session start so no matter which browser they're on they will have the same session right?
You might think, well why dont you just store the temporary item data in a mysql field or rows instead? I want to try to minimize mysql usage as much as possible, as players will be CLICKING a lot to kill mobs, it is most likely very mysql demanding as well and I want to be intuitive about it. I just want to use temporary session data for the loot. Then once the user clicks an item they want, it is EXTRACTED from their tempory item data variable, then I will use MYSQL to insert those items into their inventory.
Is this a fair and intuitive way to do temporary data for item loot? For example, in action RPG's like Path of Exile you kill a group of mobs and you see a shit ton of loot on the floor. (I imagine that loot is just temporary waiting for someone to pick it up right?) Once you do pick it up, mysql is then called to save it right? That's the same logic I have with my web based game. Is using a session variable to store that temporay loot.
Is this an intuitive way to do this, or are there other ways?
Edited by Monkuar, 24 November 2014 - 01:24 AM. Hi Guys I trying to download files and I have this error message, hopelly you guys can help me please
Warning: Cannot modify header information - headers already sent by (output started at /home/content/04/12746204/html/Digital/core/inc/init.inc.php:6) in /home/content/04/12746204/html/Digital/download.php on line 14 Warning: Cannot modify header information - headers already sent by (output started at /home/content/04/12746204/html/Digital/core/inc/init.inc.php:6) in /home/content/04/12746204/html/Digital/download.php on line 15 Warning: Cannot modify header information - headers already sent by (output started at /home/content/04/12746204/html/Digital/core/inc/init.inc.php:6) in /home/content/04/12746204/html/Digital/download.php on line 16 Warning: Cannot modify header information - headers already sent by (output started at /home/content/04/12746204/html/Digital/core/inc/init.inc.php:6) in /home/content/04/12746204/html/Digital/download.php on line 17 Warning: Cannot modify header information - headers already sent by (output started at /home/content/04/12746204/html/Digital/core/inc/init.inc.php:6) in /home/content/04/12746204/html/Digital/download.php on line 18 This is the code I use to force the download <?php include('core/inc/init.inc.php'); if(isset($_GET['file_id'])) { $file_id=(int)$_GET['file_id']; $file=mysql_query("SELECT file_name, file_expiry FROM files WHERE file_id=$file_id"); if(mysql_num_rows($file)!=1){ echo'Invalid file Id'; }else{ $row=mysql_fetch_assoc($file); if ($row['file_expiry']<time()){ echo'This file has expired'; }else{ $path="core/files/{$row['$file_name']}"; header('Content-Type:application/octet-stream'); header('Content-Description:File Transfer'); header('Content-Transfer-Encoding:binary'); header("Content-Disposition:attachment;filename=\"{$row['file_name']}\""); header('Content-Length:'.filesize($path)); readfile($path); } } } ?>Thank you for your help..... I'm using a popular PHP script for my web site, which uses main_1.htm for the header and footer, and inner_index.htm for the main part of the home page. Also, of course it has index.php. How can I set up a duplicates of these files to work on and test changes to the home page, before I actually deploy the changes on to my live site's home page? Thanks After the file gets uploaded, I intend the file to become renamed, and then moved to its destination folder. Though to move the file, I need the newly renamed file name and also its location, which is the temporary folder, and the latter describes my question. This is the script as follows: Code: [Select] $avatar_tmp = $_FILES['avatar_upload']['tmp_name']; // Rename the file into a more usable file name $new_file_name = $user_name . '_' . rand(111111, 999999) . '.jpg'; rename($avatar_tmp, $new_file_name); // Move the uploaded file on the disk to its folder // The directory of the temporary folder is needed in front of the new_file_name variable move_uploaded_file ($new_file_name, $target); The directory of the temporary folder is needed in front of the new_file_name variable and my question is, is there any function, to get the directory of the temporary folder for the uploaded file? So I can insert it in front of the new_file_name variable and move it out of the folder to its destination folder? Can anyone tell me, how the temporary file names (name of the file which is created in the 'tmp' dir ) generated by PHP when the files are uploaded ? Are there any algorithms used ? Ok here is what i got so far and now I am stuck. The user enters a number of how many squares (rectangles is note accurate) they wish to calculate. If its between 1 and 100 it continues, if its any other number it tells you to put in a number between 1 and 100. That was easy for me to do. If the number is between 1 and 100 it creates and input for length, width and height of each rectangle. creating the variables as it goes, i.e. "length$i" when $i is the while counter and increases to the ammount of rectangles you wished to view. Again, not that hard for me. So I am at the point where is I put in 50 I get length1 - through length30, width1 - width50, and height1 - height50. THis works great. However I now what to store those variables and calculate the area of each one via a while look which again creates an area$i variable which can be added (it would create area1 - area50 which I then wish to add together) Here is what I have so far. <?php session_start(); if (isset($_REQUEST['numpack'])) { if ($_REQUEST['numpack'] <= 0 || $_REQUEST['numpack'] > 100 ) { $error = "Please enter a number between 1 and 100"; echo $error; ?> <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"> <table width="0" border="0" cellspacing="5" cellpadding="5"> <tr> <td colspan="2">How many Squares</td> </tr> <tr> <td> <input name="numpack" type="text" size="4" maxlength="3"></td> <td><input type="submit" name="button" id="button" value="Submit"></td> </tr> </table> </form> <?php } else { ?> <form name="form2" method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> <?php $i=1; while($i<=ceil($_REQUEST['numpack'])) { ?> <table width="325" border="0" cellspacing="5" cellpadding="5" style="float: left;" class="aluminium"> <tr> <td align="center" rowspan="2"><span class="transparent" style="color: #FFF; font-weight: bold;"><?=$i; ?>.</span></td> <td align="center">L</td> <td align="center">x</td> <td align="center">W</td> <td align="center">x</td> <td align="center">H</td> </tr> <tr> <td align="center"><input name="length<?=$i; ?>" type="text" size="4" maxlength="3"></td> <td align="center">x</td> <td align="center"><input name="width<?=$i; ?>" type="text" size="4" maxlength="3"></td> <td align="center">x</td> <td align="center"><input name="height<?=$i; ?>" type="text" size="4" maxlength="3"></td> </tr> </table> <?php $i++; } ?> </form> <?php } } If (!isset($_REQUEST['numpack'])) { ?> <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"> <table width="0" border="0" cellspacing="5" cellpadding="5"> <tr> <td colspan="2">How many Squares</td> </tr> <tr> <td> <input name="numpack" type="text" size="4" maxlength="3"></td> <td><input type="submit" name="button" id="button" value="Submit"></td> </tr> </table> </form> <?php } ?> Now I was reading up on session data and think this might be the best way to go, but again how do I do this? and two I want to make sure that if there are 2 people accessing it at the same time, it does not change the variables on them... (i.e. user one puts in 50 values, and user two puts in 50 different values I do not want cross contamination) Any ideas on how to proceed? I'm modifying a script I built a few months ago to allow someone to upload an attachment via a form and then email it off. It is expected that this form will receive a lot of hits and so it won't be possible to store the attachment in a folder before emailing it out (right away). Problem: If I skip the move_uploaded_file part, and just attach the tmp_name the tmp_name is how I receive it rather than the PDF that it actually is. How can i change the documents name before sending it off, without saving it to a general location. My worry with saving it is, someone uploads their copy and at the exact moment it's supposed to email off, someone somewhere else uploads theirs and it overwrites the first persons and then the email gets sent with the newest persons data. index.php Code: [Select] <form action="process.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" /> <br /> <input type="submit" name="submit" value="Submit" /> </form> process.php Code: [Select] <?php print_r($_FILES); if ($_FILES["file"]["type"] == "text/plain") { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } ?> Hello folks, well what I mean by temporary variables are variables like error messages or success messages that appear after a form has been submitted. I want to be able to kill these variables when the page is refreshed and return the page to its defualt state. For example, I'm making this simple page which is basically a form that ask users for some information, then upon submit, stores the in a database and prints a success message. If the form is filled out incorrectly or some form fields are left blank, then error messages are printed. What I really want is for these messages to disappear when the page is refreshed. My current model uses a second page to handle the form, and then upon succes or upon encountering an error, redirects to the form page, passing the error or success variables via the url to the form page where they are printed out. What can I do differently to achieve what I want (ie kill variables upon page refresh)? Below are the form page, and the page that handles the form respectively. Code: [Select] <form method="post" action="send_email.php"> <div id="contact_form"> <div align="left" class="green18">Contact Us</div> <br/> <br/> <label>Your Name:</label> <input class="texta" name ="name" size="20" maxlength="49"/> <br/> <br/> <div class ="error" style="position:relative;bottom:40px;left:128px" > <?php //Retrieve the encoded errors string from send_email.php page $errors_string=$_GET['errors_string']; //Explode the decoded errors string back to an array. $errors = explode(",", $errors_string); echo $errors[0];?> </div> <label>Your Company Name:</label> <input class="texta" name ="company" size="30" maxlength="66"/> <br/> <br/> <div class ="error" style="position:relative;bottom:40px;left:128px" > <?php //Retrieve the encoded errors string from send_email.php page $errors_string=$_GET['errors_string']; //Explode the decoded errors string back to an array. $errors = explode(",", $errors_string); echo $errors[1];?> </div> <label>Subject(Optional):</label> <input class="texta" name ="subject" size="20" maxlength="49"/> <br/> <br/> <label>Email:</label> <input class="texta" name ="email" size="20" maxlength="49"/> <br/> <br/> <div class ="error" style="position:relative;bottom:40px;left:128px" > <?php //Retrieve the encoded errors string from send_email.php page $errors_string=$_GET['errors_string']; //Explode the decoded errors string back to an array. $errors = explode(",", $errors_string); echo $errors[2];?> </div> <label>Message:</label> <textarea style="float:left" class="" name ="message" cols="40" rows="3"> </textarea> <br/> <br/> <div class ="error" style="position:relative;bottom:-19px;left:-260px" > <?php //Retrieve the encoded errors string from send_email.php page $errors_string=$_GET['errors_string']; //Explode the decoded errors string back to an array. $errors = explode(",", $errors_string); echo $errors[3];?> </div> <button class="button" type ="submit" name ="submit">Submit</button> <br/> <div id ="sent" > <?php //Retrieve the user id from send_email.php page $sent=$_GET['sent']; $send_msg = urldecode($sent); echo $send_msg; ?> </div> <!--closes sent--> </div> </form> Code: [Select] <?php //address error handling ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); if (isset($_POST['submit'])) { $errors = array(); // Connect to the database. require('config/config.php'); //Check for errors. //Check to make sure they entered their name and it's of the right format. if (eregi ("^([[:alpha:]]|-|')+$", $_POST['name'])) { $a = TRUE; } else { $a = FALSE; $errors[0] = '*Please enter a valid name.'; } //Check to make sure they entered their company name. if (!empty ( $_POST['company'])) { $b = TRUE; } else { $b = FALSE; $errors[1] = '*Please enter company name.'; } //Check to make sure email is valid. if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['email'])) { $c = TRUE; }else { $c = FALSE; $errors[2] = '*Please enter a valid email address.'; } //Check to make sure they entered their message. if (!empty ( $_POST['message'])) { $d = TRUE; } else { $d = FALSE; $errors[3] = '*Please enter your message.'; } //If no errors if (empty($errors)) { //Create variables for all the post values. $name = $_POST['name']; $company = $_POST['company']; $email = $_POST['email']; $message = $_POST['message']; $ip = $_SERVER[REMOTE_ADDR]; $date = (date("Y/m/d:G:i:s")); $timestamp = ( mktime(date(H), date(i), date(s), date(m) , date(d) , date(Y))); //Formulate the insert query. $query = "INSERT INTO emails ( email_id, name, company, email, message, ip, date,timestamp) VALUES ( 0, '$name','$company','email', '$message', '$ip' , '$date', '$timestamp' )"; $result = mysql_query($query) or die("Data could not be inserted into table because: " .mysql_error()); if (mysql_affected_rows() == 1) { // Display success message $sent_msg = "Your email has been sent. We will get back to you shortly."; $sent = urlencode($sent_msg); // Display contact page header("Location: contact_page.php?sent=$sent"); exit(); }else{die("There was a problem: " . mysql_error());} //Display error messages. } else {// if errors array is not empty //Confer the errors array into a string $errors_string = implode(",", $errors); //Encode the imploded string. $error_message = urlencode($errors_string); // Display page header("Location: contact_page.php?errors_string=$errors_string"); exit(); }//End of if there are errors. }//End of if submit. ?> Also, another problem I just noticed is that, the errors[3] variable isn't getting passed back to the form page. I don't know if it's because the url can only pass so much info to a second page. The page in question can be located he http://creativewizz.com/contact_page.php Bear with me, as I'm still quite new at PHP. I'm trying to figure out the best way to build a search function for a database that will eventually be quite large. The path of the search I'm building is to go from a straight-forward javascript and html search page, to a paginated search result. Then the user can narrow down those query results based on a new search of their results. In trying to get the pagination to work across several pages(unsuccessfuly, I might add), I've been learning about sessions and temporary tables. But, because the database will be very large, I'm wondering if they are the wrong way. Sessions have a time limit, and temporary tables delete once the connection is closed. Is it possible/feasible to build a permanent table that puts in the search variables, with a unique id and use this to manage the searches, pagination and all that? Then, at some point in the process, I can put code to delete the corresponding row (or even make it a saveable search). Maybe somebody sees where I'm going with this and can describe it better than me? I'm just thinking off the cuff at the moment. Maybe there's some terminology that will help me find a tutorial. Any bit helps. thanks! Hi guys, I can't find any code to help me out with this so I was hoping you guys can. I need some PHP jquery/AJAX code that allows me to do the following: Double click a disabled text box, edit the value and on click out (or whatever) it re-disables and makes the chages in the mysql DB automatically. Hope you guys can help me out. Cheers in advance Hi all, I could do with some help ... What I am trying to do is insert some additional div in the piece of code you will see below, but I've been having some troubles as to what stntax I should be using and where to place those div ... In order to help you help me, I suggest you have a look at this page elhoster2.com/europeshuttle , make a search with country "sweden" as "return trip" . From there you will see 2 results. This is the page I am trying to layout. Basically, the image is on the left and then I would like to have a div floated on the left that will contain the services (multilingual driver , greeting sign etc ), another div with the info seen in bold (passengers =1, charges are per vehicle) and a last div with all pricing info. My issue is that I don't really know how to break this piece of php code to achieve the desire effect ... I hope someone will be kind enough to help me with this. Code: [Select] function get_tours($type,$country,$airport_start,$city_start,$psg,$way){ $mysql=new MYSQL; $q="select * from tours where tour_country ='$country' and tour_airport='$airport_start'and tour_city='$city_start' and tour_standard='$type' and veh_seats >='$psg'"; $res=mysql_query($q,$mysql->connection); if(mysql_num_rows($res)>0){ while($r=mysql_fetch_array($res)){echo'<form id="booking_2" action="booking-form.php" method="post">'; echo'<div class="search-results spacing-bot" ><figure class="img-indent"> <a class="lightbox-image" href="'.SITE.$r['tour_vehicle_picture'].'" data-gal="prettyPhoto[gallery1]"><img src="'.SITE.$r['tour_vehicle_picture'].'" width="188" height="138" alt=""></a></figure> <div class="search-results-info">'; #THIS IS WHERE THE SERVICE LIST BEGINS ########################################### $tour_id=$r['tour_id']; $serv="select * from services_to_tour where tour_id='$tour_id'"; $re=mysql_query($serv,$mysql->connection); while($ro=mysql_fetch_array($re)){ $serv_id=$ro['serv_id']; $this->get_serv($serv_id); } #THIS IS WHERE THE SERVICE LIST ENDS I GUESS AND THAT I WOULD LIKE TO BE IN ITS OWN DIV ########################################### #FROM HERE I AM GETTING A BIT CONFUSED WITH THE PHP AND HAVE NO IDEA HOW TO STYLE IT !!!########################################### $crg_by=$r['tour_price_per']; if($crg_by=='per vehicle'){ $crg='per vehicle'; $tour_price= $r['tour_price'] ; $tour_r=$r['tour_price_return']; $total=$r['tour_price'] + $r['tour_price_return'] ; $total_i=$r['tour_price']; $total_b=$r['tour_price_return']; } elseif($crg_by=='per person'){ $crg='per passenger';$total_i=$r['tour_price'] * $psg; $tour_price= $r['tour_price'] * $psg; $tour_r=$r['tour_price_return']* $psg; $total= $tour_price + $tour_price; } if($way=='Return'){$price='Collection: '.$tour_price.' Euros<br />Return: '.$tour_r.' Euros'; $total=$total; $amount=$total;$percent='15'; $online=$this->get_percent($amount,$percent); $pr=$online;$total='<br />Total Price: '.$total.' Euros<br />Payable online: '.$online.' Euros'; } else{$amount=$tour_price;$percent='15'; $online=$this->get_percent($amount,$percent); $price='Price: '.$tour_price.' Euros<br />Payable online: '.$online.' Euros';$total='';$pr=$r['tour_price']; $pr=$online; } echo'<span class="p1"><strong>Passengers:</strong></span> '.$psg.'<br /><span class="p1"><strong>Charges are by '.$crg.'</strong></span><br /><span class="p1"><strong>Price </strong></span><br />'.$price.$total.'<input type="hidden" name="tour_id" value="'.$tour_id.'" /> <input type="hidden" name="way" value="'.$way.'" /><input type="hidden" name="psg" value="'.$psg.'" /><input type="hidden" name="price" value="'.$pr.'" /><input type="hidden" name="price_in" value="'.$total_i.'" /><input type="hidden" name="price_out" value="'.$total_b.'" /><input type="hidden" name="operator" value="'.$r['operator_id'].'" /><a onClick="document.getElementById(\'booking_2\').submit()" class="button" style="float:right"><strong><strong>book this transfer</strong></strong></a></form> </div> <div class="border-bot"></div> </div>'; } } else{echo'<p>Sorry your search returned no results.</p>';} } I currently have a Javascript placed at the top of the same file as my HTML form. Now I need to run the file as PHP, and was wondering what the proper protocol and best practice is for the JavaScript (which does some client side validation). Can I leave it as is, at the top of the file after changing the extention to PHP. If I put it in a seperate file, should I call it as a JavaScript or as an INCLUDE file. If I INCLUDE it, should the INCLUDE be a PHP file (that contains the JS, or a JS extention. Does any of this make a difference, or will any method work, leaving it to personal preference? I have gleaned a script from modified bits of tutorials and ended up with this: <td> <form name="input" action="fotw.php" method="post"> <h4>Want a specific film? <input type="text" width="300" name="requests" /> <input type="submit" value="Request" /><input type="hidden" name="thanks" /></h4> </form> </td> <?php $requests = $_POST['requests']; $data = "$requests\n"; $fh = fopen("../filmoftheweek/users.txt", "a"); fwrite($fh, $data); fclose($fh); /*if (???????? HELP!);*/ // request button has been clicked echo "Thanks, I'll see what I can do."; // In the field I have highlighted in red ?> What I want to do is get the Thanks message to print to the right of the request button but, being a total noob because I didn't pay attention at college during any php bits, I have no idea how to go about it. It's just a visual thing really as I know the text file gets written but, disappearing text does little to reassure the user that something has happened. Probably the field won't be any good as a place to get printed but I tried (for hours) on this. Any help would be greatly appreciated. Along with an explanation, doubly so. Many thanks in advance, Paul Note to moderators: CSS is an acronym for Cascading Style..? Sheet/sheets [attachment deleted by admin] I have a membership directory that I've been working with for a long time, and recent server upgrades with MySQL, PHP, etc. forced me to do some recoding. While I was doing that, I wanted to try and make some improvements. I must give a brief description of the intent, and then the results I got, so someone can sort out the problem for me. I have a query that selects all "Agent" members, then orders them by County, then by Company Name. What I am trying to do is create a new heading in my list every time the County information changes as the list is sorted and output to my table.
I am going to attache 2 .php files with my code. The agent_member_list.php is the original code that pulls all of the members properly, and results can be viewed he http://www.nmlta.org...member_list.php
The agent2_member_list.php is where I'm trying to insert the new conditional statement to print my County headings when a new County is encountered in the results. The heading actually works, and changes correctly, but the problem is that the first member entry in every county is not printed in the output. I know the query is correct, so I'm sure I've got the conditional "if" for checking County field wrong, or misplaced. Here is the link to it: http://www.nmlta.org...member_list.php
I'm hoping someone can spot my error pretty quickly, I only dabble in this very rarely. Thanks for any help!
Attached Files
agent2_member_list.php 5.06KB
3 downloads
agent_member_list.php 4.82KB
2 downloads |