Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Add To Date Based On User Selection


I have a form with Radio buttons that when selected should add "$howMuch" amount of hours to the current date and time and put the output into a field called "ExpireTime". The code I'm using for the hour adding: PHP Code:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Dynamically Populating Listboxes Based On Previous Selection
How do I populate the second listbox in this form based on the selection of the first listbox?

The first listbox is populated by this query:
$year_query = "SELECT distinct year FROM bench_data";
The second listbox should essentially be populated by this:
$industry_query = "SELECT distinct comp_desc FROM comp_desc, benc_data where $_POST['year']=bench_data.year and bench_data.comp_key=comp_desc.comp_key";

I know this is alot to ask, but please EXPLAIN the code.  I am new and need the explanation elucidated and not just supplied code that will accomplish the goal. Code:

User Selection From Drop Down Menu
I have 2 drop down menus. 1 is to pick a Province and the other is to
pick a trade (plumbng electrical etc)

The user selects which province and then what trade then hits submit
which should list all entries in the table. How would I formulate the
select statment for MySQL to display the results in a webpage. The
variable in my form are $province and $category

Date Selection
I have some records in my table that I need to extract if they are equal or greated than the current date. The date fields are in format YYYY-MM-DD. Could someone please provide some details on how to do this in php, I think I have a rough idea.

Set date variable to current date, select all records from database where database date is >= current date.

Select Statement With Changing Tables Base On User Selection
I am trying to make a select statement that would allow me to change the table, base on the user selection from a drop down menu list. I don't know if its possible or my syntax is wrong PHP:

sql = SELECT * FROM "'.$_POST[Tableselection].'" WHERE  "'.$_POST[userid].'" ='1';

Retrieving Database Info Based On User
I'm still quite new to php and mysql but I have been unable to figure this out.  I'm attempting to display a specific row and column from a mysql database based on the user.

$result = mysql_query("SELECT fbleague FROM users WHERE username = $_SESSION[username]");
fbleague is the column
users is the table
username is the primary key column
$_SESSION[username] is the username variable

Then later I try to display it with

echo "You are in league $result ";

I know $_SESSION[username] is set correctly because I can display that with no problems. 

Dynamically Creating URLS Based On User Input !
I am looking to create pages on the fly or dynamically based on user input. For example if i have www.example.com and they visit this and enter 'bob' in a textfield and press submit they create www.example.com/bob.html . How would I go about this ? I am guessing I need to create a folder when submit is pressed in my website directory ?

Get Date Based On Weekday?
I have this:

Mon, Tue, Wed, Thu, Fri, Sat, Sun created as links. What I would like to
do is to associate days with its current week dates, for example:

Mon (05.01.2004); Tue (06.01.2004); and so on.

Deleting A Field Value Based On Date?
How would I delete a field value in a mysql database every 24 hours? Anyone know?

Calculate Age Based On Date Of Birth
I am trying to validate whether or not a date of birth entered in dd/mm/yyyy format is between 16 and 69 years old.  Suppose we have todaysdate = 18/04/2007

The minimum allowed date of birth would be 18/04/1991 and the maximum allowed date of birth would be 18/04/1938.  I have looked at using strtotime but this only does dates from 1970 (I think)

Clause Based On Date/time
I have a database that returns a field with a date and time that looks like this:
12/04/2007 07:45:03

I need a simple clause that says if the time is before noon then A else if the time is after noon then B I could split the date from the time in a string then split the time by the : but there is a much easier way, right?

Php/sql Question - How To Build A Dynamic Query Statement Based On User Input
I need to build a query based on what the user checks in the form. For
example, if the user does not check certain fields, I don' tneed to use
those in the query statement.

Displaying 'new' Icon Based On Date?
I'd like to display a little "new" icon next to all products in a directory which are, funnily enough, new! I've got a date (timestamp) for each product which is inserted on adding a new product and updating a product.

I'd like to do a conditional region using the timestamo but I'm not sure what to use - I could do === [current date] but that would only show the icon for that day and I'd like it to be there for about a week or so.

Generating Reports Based On Date/time Conditions
I need to generate reports in three ways:

I have a Date field in my database...

today
$query = 'SELECT * FROM 'table' WHERE Date = today';

Past seven days
$query = 'SELECT * FROM 'table' WHERE Date - 7';

Choose month( drop down preferably)

$query = 'SELECT * FROM 'table' WHERE Date = "'.$_POST['monthselected'].'"';

Get Most Recent Row On An Inner Join Mysql Query Based On Date
Here is my current query:

SELECT tbl1.id, tbl1.username, tbl1.status, tbl1.joined, tbl2.timeDate, tbl1.directory FROM tbl1, tbl2 WHERE tbl1.id = tbl2.users_id GROUP BY tbl1.id

This returns their oldest ie first login.  I use this for analytics on the backend to determine user activity.  So I would like a query that instead that returns the most recent tbl2.timeDate.

Auto Delete Date Based Calendar Events
Out of both wanting to improve my PHP skills and necessity, I created my own small CMS for a non-profit site I am involved with. One of the features I have is an event calendar where other users can submit  events, which then go into a "holding tank" until I can approve or deleted them. It's working great and everyone is loving it... but I have discovered one issue. When the date of the event passes, I have to log into the admin area and manually remove it. I am actually not deleting it from the database but changing a field variable and archiving it for our records.

I have been trying the past few days to come up with the necessary PHP to automatically check the current date (today's date) against all the calendar events and remove ones that have already happened. I could then hook this up to a CHRON action in my hosting CPanel and call it a day - at least that is how it all plays out in my head. 

I imagine in order to point me in the right direction you will need some information about my database.

Getting Day Of Week From User Defined Date?
is there a way to do this? e.g. i have three drop down boxes in html asking the user for day (1-31), month, year (2007 or 2008) i then have:

// get user input
$start_day = $_POST["start_day"];
$start_month = $_POST["start_month"];
$start_year = $_POST["start_year"];
//echo $start_year;

$the_date = $start_day . "/" . $start_month . "/" . $start_year; echo $the_date; say then i get an output as 13/10/2007 if the user enters that date, is there a way to get what day of the week this is?

Taking Date Of Birth From User And Sending It To A Mysql Database
i have created a form that takes a users date of birth as 3 seperate values $day $month and $year i do not know how to combine these values into a single value called $dob.
I tries using just a singal value to take the date however it did not work, even after I had formated my database.

Convert User Entered Date And Time To Unix Timestamp Before Inserting To Database
How do you convert a user inputted date to a unix timestamp before
insterting it into your database? I have a form, with a textfield for
a date that the user inputs in the format mm-dd-yyyy and three dropdow
boxes for hours, minutes, and AM/PM. All of these need to be considered
together and converted to one Unix Timestamp and then inserted to the
MYSQL date field. The type of field is INT (11) so that I can instead
of the standard 0000-00-00 format of MYSQL so that I can do better
calculations and queries.

EyeOS : Opensource Web Based Operating System Based On "php"
EyeOS is a Opensource web based operating system based on "php".

try demo here

http://eyeos.info/eyeOS/

Selection
I am making a log generator and I have a minor issue with this script PHP Code:

Selection Box Via Selection
Basically I have a selection box which gets it's values from a database once this is selected the selection box's below will get the correct value from the above selection box which again comes from the database.

The first selection box works by refreshing the current page and adding a variable to the file for example instead of useraddnew.php it would be useraddnew.php?maintcat=5 but the number 5 only gets set the second time you choose from the top selection I hope some one can help sorry if I explained it poorly. Code:

Selection Of Ajax Lib ?
I m working on an PHP based site where in UI I need to use ajax
funtionalities ... I just want some opinion from experts that which LIB
is best for usage.

I was wondering that using XMLHTTP is sometimes a bottleneck for cross
browsers application.

Different libraries are here but not sure which one to select.

Selection Box Only Showing 1 Why?
I am using the following select code: PHP Code:

Database Selection
I created two web database applications - first one is the company
news system (as part of the company pages), second one is the
company data presentation system (part of the company pages, too).
All (unfortunately) the M$ environment - NT or 2003 server.

The first app is managed from the web interface, the second app is
managed by database client win32 app (created by PowerBuilder, std
client-server approach, ODBC). For the second app I need to create
the web presentation interface now (no data modifications, heavy sql
queries :-( ).

The first app contains only small amount of data (10 database
tables, max 100 rows in the largest table) but the second app
contains large number of tables, more than 100000 rows in major part
of tables, very sensitive company data, requires sophisticated and
intelligent db engine strategies for queries, ...

For the first app I wanted to use MySQL, for the second one I wanted
the Sybase SQL Anywhere. But now I am in doubt. I'm playing with the
idea to substitute the Sybase SQL Anywhere by the PostgreSQL or
MySQL. I need all the SQL decorations (stored procedures, stored
functions, triggers, declarative referential integrity (foreign
keys), ...) I'm playing with the idea to unify the database
environment (use only one db engine and two databases, not two
different db engines for two databases), too.

Is the MySQL or (preferably-IMHO) PostgreSQL database engine stable,
robust, safe, ..... in order to use it for these company very
sensitive data, for heavy data mining app, ... ? Is it safe to unify
the database engine types and use only one engine for these two
apps/dbs? Can I rely on the MySQL and/or PostgreSQL engines? Do you
suggest me to use (one of/both) these two db engines for the main
company data presentation database?

Multiple Selection
I have a form that grabs reords from a mySQL database and presents the information in a nice pulldown menu. The client now wants that little menu to be a list that you can select multiple resords from (this is a brochure request for - the list has a max of 12 pieces).

I know how to get the form to look the way I want, but when I parse the form with the little app I wrote in PHP that varifies the data entered, checks feilds, and then enters it in a mySQL database for tracking purposes - there is only one record in the database - even though there were more that one records selected. Now I am simply entering $properties (the variable of the menu feild) in the the INSERT statement of my database query - do I need to parse the records selected first - what am I doing wrong...?

Seperate Selection
I am trying to select data stored in a database as u can see and it gets dispalyed. But my problem is I need to beable to select each item individually instead of all at once or 1 item only. I need to beable to select say bread as an item and milk as an item but at the moment I can only select 1 or all items. PHP Code:

Selection From A List Box.
php and have to implement this functionality to
select a user from a list box. I have written the code for this, but
the problem is after selecting a name and doing the required task, it
again selects the first entry in the list box. So if there are 100
users, the 100th one has to scroll down again and again.

I need to modify this code so that until the session expires, if a
person has selected his name once, that name will be selected in the
listbox until he changes it.

<select name="name" style="width: 120px;">
<?php
$query = sprintf("select * from person order by person_name");
$result = mysql_query($query);
$i = 0;
while($row = mysql_fetch_array($result))
{
$i++;
printf("<option
value="$row[person_num]">$row[person_name]</option>");
}
?>
</select>

Form Selection
I am working on a form right now that when you click a radio button at the top it will select a few of the other radio buttons. Here is the code that i have. I just dont know how to do this. I have never done this type of form before. Code:

Listbox And Its Selection
im trying to create a webpage using mysql and php. im using the below code to populate a listbox with playernames held in my database. once i select a name; im trying to make the page gather the relevant information from that users details to be displayed on the same page.

for example if i select "MoFish" from the listbox, i want it to echo all MoFish's details in the page such as his:

"age"
"height"
"weight"

if i select "Berty" i want it to echo bertys details. how can i acheive this? Code:

Random Selection
i want to randomly select 5 different values from a database, from one table, and then just assign those values to some php variable.

Option Selection
I am making a Option Box (Drop down bar) for Gender, (Male,Female) and I want when they Select there Gener, and then hit submit, it Writes to to a Database.

i have it set it up so far that it goes to another page to INSERT it into the Databse.

Dynamic Variable Selection...
Is it possible to create a bunch of variables in a loop with different #'s at the end of their name... like:

while ($counter <= 10)
{
$myvar$counter;
}

to create 10 variables.... mayvar1, mayvar2, mayvar3, etc.....
is there a way to do that?

Getting Multiple Selection Into One String
I have a listbox with 5 options. I have set it up to be able to choise more than one option. What I need to know is how to get all the selection into the one string that is stored in the DB

It is easy to get the first selected option to post into the DB.

Random Selection Of CSV's
Is there a function in PHP-MySQL to randomly select comma-seperated
variables in a text field?

For example if you have a text field containing the values
"1,1.2,4,5.6," is there a way of randomly selecting one of the numbers?

Multiple Selection Form
I have made a multiple selection form, but when I select more than one option, it still only returns one. PHP Code:

Random Selection Of String Value
Please tell me how I can randomly select a string from a limited set
of string, and then use it in links.

With equal probability, suppose half the time I want
to form a link to domain.com/1234/page.htm and half the time I
want to link to domain.com/5678/page.htm . I would like to be
able to put something into my link such as:
domain.com/<?php ... WHAT GOES HERE? ... ?>/page.htm

If possible, I'd like to use a method that will put either 1234 or
5678 into a variable, so that, once it's randomly chosen for a
document sent to the browser, then numerous references to that
same string value can be used on the page.

Multiple Selection Lists?
i have a mutliple selection list on a form that goes like this

<select name='name' multiple size=6>";
echo "<option value='one'>one";
echo "<option value='two'>two";
echo "<option value='three'>three"; etc it works fine.

BUT how do u call it. For example say i selected option one and three. How do i call that on the next page so that ONE and THREE are stored.

Printing A Document Or Selection
Is it possible to print output generated with php to a local printer attached to a PC or MAC... The server being used is shared hosting.. not a windows server... I was looking at the Printer Function in the php manual but it is not very clear.

Selection Of Records In List
I was wondering how to query MySQL to display only a selection (1-20,
21-40) of a query in an HTML list. Can that be done in an SQL
statement, or do you have to use PHP to dissect the returned array
with for n elements to n+20 elements. How does Google achieve the
returning of results in its search engine. I imagine that the same
query may not necessarily be executed each page listing. I am
wondering whether the results from the query would return an array of
say 36000 elements.

Make Selection In Array
I have this array:

name => john, age => 45, profession => teacher
name => hank, age => 22, profession => student
name => mary, age => 36, profession => dancer
etc.
etc.

It's going to be a big array.

Now what i wonder, how can i do the following;
while( $array['name'] == 22 )
{

do something.

}

I want to prevent the following:
while( $array )
{

if( 'name' == 22 ){

do something

}

}

Because this would create a big loop everytime.

Default Selection From Query
I'm having difficulty trying to have a DEFAULT selected record from a query in my dropdown box (code below). I have about 20 records in a 'facility' table, which listed names of our company's locations. I want to default select one of those records "exton" to be selected in my dropdown box. Code:

Multiple Lists Selection
I am using a simple registration form that i made with the toolbox, but when I come to a multiple list to choose from (populated from the database) it doesn't work correctly. Of course, out of the multiple items selected only the last one gets inserted.

From what I have read, the selection must be turned into an array then looped for this to work. Is this correct? Next how would I code this to work right. If you let me know which code to post, I will post it.

How To Combining 2 Db Fields Into One Selection?
In my db I have 2 fields: first_name and last_name & I want to combine these 2 fields in my drop-down menu.

What I have now is showing only the first_name -- I know that it needs to go into the third option in here, I'm just not sure how to get both of them into it. I can get the first_name OR last_name, but not combined. Code:

Remember Drop Down Box Selection
Is there a better way to do it than i currently am using? Simply echos the value in the selected option that will otherwise be blank, so this makes it impossible for the user to select no input. Code:

Multiple Selection Lists &
I have 2 multiple selection lists. I am using javascript so that users can select items from list 1 and move them to list 2. When the user submits the form I need my php to get the values he has/she has in list 2...

I have done printf($_POST['list_2']) and it only shows one value, even when multiple are selected. I read that I need to change it's name to list_2[] but if I add the brackets to the name my javascript quits working.

Form Selection Target
I would like to design 1 php page where a dropdown list will appear. depending on the user's selection, it will go to the next dropdown list (the list will appear only after the first dropdown is selected) and so on.. .. at the end, a textarea box will appear that will display all the variables that the user have selected. How do I go about in making that happen?

Dynamically Filling Selection Boxes
I was wondering if anyone knows how to fill a selection box with different values depending on a selection made in a nother selection box in the same page. I dont know if what I'm tryin to do can be done or not, at least in PHP. First a quick background:

We have a number of projects running right now, each of which is subdevided into various tasks. Now, I've got two selection boxes. The first contains a list of all current projects. What I want to do is this: when someon selects a project from the first box, I'd like the second box to be filled with a list of the tasks that have been assigned tot hat project.

Building A Category Tree For A Selection Box?
I'm trying to create a selection box in a form which displays all categories in a database, along with indents for sub categories. Code:

Wiki Software Selection Advice ?
We have a short list of wiki software listed below that we are
evaluating. The project will also be using wordpress and there will
need to be some integration between the wiki and wordpress. It seems a
wiki that can use mysql and is also PHP based would be favorable.

I had also considered DBM/DBA which are object persistent databases,
but our team does not seem to favor that solution, though I have not
really analyzed that approach or have enough experience to feel I
understand all possible advantages or disadvantages that it might
have. I have not been able to find a DBM that works with PHP on
windows which some development will be on. It has been mentioned that
DBA is not going to cache the way a database does, although I also
heard somewhere else it would be faster and I suspect using memcache
with DBA would work, but I am not sure if there would be references
inside the objects that would cause a problem with that ?

I had looked into phpwiki, but had many problems with the install on
windows and I didn't see that it have very good wysiwyg editing.

Anyway, the short list:

mediawiki
bitweaver
jspwiki
snipsnap

pmwiki is set up to use flatfiles, so we may be dropping that,
although possibly it could be modified to work with mysql.


Copyright © 2005-08 www.BigResource.com, All rights reserved