Jump to content

jeff5656

Members
  • Posts

    744
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

jeff5656's Achievements

Advanced Member

Advanced Member (4/5)

1

Reputation

  1. I want to parse the following POSTed variable (notice that each element in this variable is separated by a semicolon and a space) $variable = "201px; 169px; 110px; 114px; 142px; 43px; 112px; " so that $a="201px" $b="169px" etc a) how do i do that b) how do I do that if the number of elements to parse is NOT known? If anyone knows the solution to a) but no tb) thats ok - I can try to figure out b once I underatand how to do a!
  2. Hi, I know very little about javascript. the following script echos out column width after a user drags the columns of a table. I would like to capture the output into a form, so the user can submit it to their record and system will remember settings if they reload the screen: $(function(){ var onSampleResized = function(e){ var columns = $(e.currentTarget).find("th"); var msg = "columns widths: "; columns.each(function(){ msg += $(this).width() + "px; "; }) $("#sample2Txt").html(msg); }; Now this line: columns.each(function(){ msg += $(this).width() + "px; "; }) seems to echo out the widths of each column (the display says something like: "Column widths: 112px; 256px; 320px; 15px") How can I have each value get echoed into a separate input box (type=text)? Then when user submits the form, I will use php to process form and get the values into a database.
  3. I am trying to select records where the date is 35 days from now or less (i.e less than 35 days from now includes all dates that have passed as well). However, when I do the code below, $query = "select * from institutions where exp_date < date_sub(now(), interval 35 day) order by name"; all I get are expired records. I have a record where the exp_date is 3/23/13 but it is not getting selected. Note: the exp_date is a DATE field.
  4. Inside a <script type="text/javascript"> I have a function. Insuide that function I am echoing out variables using php code. while ($reqarray=mysql_fetch_assoc($rrr)){ ?>errors += checkText(formname, '<?php echo $reqarray['var_name'];?>', '<?php echo $progarray[$progname];?>');<?php } however, the script does not work because there is no line break after each "errors += checkText..." line. Apparently the script won't work unless everything is on it's own separate line (even though it ends with a semi-colon;). How do I echo out a line break inside the while loop to put each one on a separate line? If I echo a <br/> it doesn't work(it just puts the text <br/> there.
  5. Thanks for that code - but how does it know that the current year is 2012 if all they type is 12/23?
  6. But does anyone know how to do this, or is it something that can't be done. I feel that PHP can do anything really, but this is a bit out of my range - that's why I came here because I know someone out there knows! I appreciate the feedback about user input etc, but if there is anyone that knows how to do this I would love to see what the code looks like that would make this work.
  7. How do a) check if the user has only added month and day and b, add the current year to the variable $this_date if the user has not entered the year?
  8. I have a date field in a form. If a user enters 12/23 instead of 12/23/12 I want to add the current year before putting it into the datatbase. The format in the database is Y-m-d because it's a date field. How do I modify this code to do that? I'm sorry I'm a bit weak with dates, especially if I have to stray from the standard date code! $this_date = date("Y-m-d", strtotime($_POST['this_date '])); $query = "insert into table (this_date) values ('$this_date')"; If a user enters 12/23/12 or 12/23/2012, I do not need to add the current year, and the above code will work, so I need the code to take into account a user entering the year OR not entering it.
  9. Let's say I have a bunch of records in an array and I want to echo one out: echo $somarray['somefield']; but lets say I want to have a variable instead of "somefield". How do I do this? This is what I want to do but the syntax is wrong: $hello = "somefield" echo $somarray['$hello']; Thanks.
  10. When a user enters data into a text box, I want to retain those carriage returns. Therefore I use nl2br. The problem is that when they go to edit the data again, another carriage returns is added. How do I 1. allow carriage returns in a text box and 2. avoid duplicate carriage returns, which the nl2br solution will do? here's the code: <form> <textarea name="medications" value = <?php echo nl2br(stripslashes($rpw['meds']));?></textarea>
  11. Thanks for the link. That was the problem.
  12. When I added this: echo "error is ". $_FILES['imagefile']['error']; I got error is 2 I think that error means maximum file size? But this file is only 1.8 megs and the godaddy limit is 8 megs so I dont know what the deal is here...
  13. I am trying to upload a file that a user chose from a form. However, when I look in that directory, the file is not there. Although I have error_reporting(E_ALL), I am not getting any errors - just the file is not there. Is there anything wrong with my code: move_uploaded_file($_FILES['imagefile']['tmp_name'], $_FILES['imagefile']['name']); I assume that with the above code, the file should appear in the same directory. or does it have to do with the permission of that directory. It is set at 705. I don't think godaddy (no jokes please) allows me to go to 777 (just to test it).
  14. I promise I will write some code very very soon to force valid email for users. :-) But in the meantime I wanted a quick and dirty way to get all the ones who already HAVE valid emails and export them to an excel file, because otherwise I have to wait for those users with invalid emails to log on and give me their correct ones. Until they log in, that record will contain an invalid (or more commonly blank) email field. Obviously in retrospect I should have required a valid email from the start! :-)
×
×
  • 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.