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




How To Change Data Dynamically ...


I'm developing a system where user has a previlage to select
his/her COUNTRY then STATE then CITY respectively. i've put all the
Country names, State names and City name in a Drop-Down combos which
is filled dynamically from the MySQL database. Now my problem is that
i want it in such a way that if one select USA as COUNTRY then all the
STATE(s) of USA should be displayed on the STATE combo not any other.
and then when user selects the STATE in the next combo the CITY combo
should be populated with cities related to that STATE only and not
with any other.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Dynamically Change META Tags
I am just wondering, if it is possible to dynamically change META tags through the use of PHP?

Any help is much appreciated. And yes, i am a beginner, on page 93 of Sam's PHP & MYSQL web development...

How To Dynamically Change Page Title Using Php And Require_once?
This is an elementary question, but I've not been able to find the
answer, so here goes:

I am developing a site using php. I have the html header information
in a file that I include in all the pages using the require_once
function.

That is, each page includes the line

<?require_once('PageStart.php')?>

The PageStart.php file essentially defines the header. Omitting the
boring stuff, it's laid out like so:

<html>
<head>
<title>The Title of the Page</title>
<?require_once('styles/PageStyles.css')?>
</head>

<boring stuff snipped>

This works great. The only complaint I have is that there are LOTS of
pages on the site, and using this approach means that every page is
titled "The Title of the Page" When scanning my browser history, I
could have surfed to 30 different pages in the site and they all have
the same title. Makes it hard to know which page I'd like to go back
to.

I'd like to have a way to pass a (sometimes) dynamically generated
page title to the PageStart.php file. I say sometimes because certain
pages (the Main one for example) will always have the same title, so
that could be passed statically. There is another series of pages in
which the same php file accesses a MySQL database to display
information about various family members, and I'd like that title to
be generated dynamically (for example, "All about Mary" or "All about
Ted" depending on the person being described in the page).

Now I KNOW that with php there's a way to do this. I just can't find
it.

Making Dynamically Created Checkboxes Check On Value Change?
I have no idea if this is more a PHP question or Javascript question,
because my problem hinges equally on both.

I have a PHP script that queries a database and creates a list of rows
for each item, each with their own checkbox one can select to do stuff
later. The PHP script this form posts to creates an array of all the
selected checkboxes and does stuff.

But, on the form, I want to be able to have the checkboxes auto-check
when someone changes the value of a textfield on that row.

With some stuff cut out, here's what I have on the form:

<!-- Begin
function NotEmpty() {
if (document.f.trackno$oim.value!="") {
document.f.remship.checked = true ;
}
}
// End -->

<form name="f" id="f" method="post"
action="trackpareportproc.bkk">
<input name="remship[]" type="checkbox" value="$oim"
class="remship">
<input type="text" name="trackno$oim" size="40"
onBlur="NotEmpty();">

Obviously I think the problem rests in how do I get the JavaScript to
know which checkbox to check. I can't make the NAME for each checkbox
unique otherwise that would mess up the array that's created later
based on which checkboxes are selected.

How To Populate Selects With Years=>months=>days That Dynamically Change?
What I'm thinking of doing is in my admin page have three different selects. They will form the day of sales at my shop.

-YEAR- -MONTH- -DAY-

The years will have 2002 -> 2005 and the months will be the 12 months of the year of course but I need the number of days to change with the particular month selected.

[PEAR:QuickForm] Dynamically Change A Dropdown Menu According To Another Menu?
I've been using QuickForm for a few months now and I am now given a
new challenge:

I've got a search form with a dozen of dropdown menus, the first
dropdown menu being "Brand". If you select either Brand A, B, C, D...
Z, the second dropdown menu "Model" must be dynamically changed to
model AA, AB, AC, AD..., according to the models manufactured by the
brand selected in the first box.

I've seen that done on quite a few sites, but never found if QuickForm
had a quick & clean way of doing that.

Data Type Change Without Loosing Data
I have a problem in mysql. I stored a date in  08/14/2006 format and choose a datatype longtext now i want to store date in 2006-08-14 form is it possible to do it without loosing data in db when i convert datatype longtext to date the data lost. Any solution?

Getting Dynamically Generated POST Data
I'm trying to get POST data that was dynamically generated and I'm not sure how to go about doing this.

Saving Data Into Database From A Dynamically-added Textbox
let's say i have a html form with textboxes that can be dynamically added with javascript.

i'd like to save each of the textbox's value into a new different row in the database.

so i'll have this in my html form:

<form action='/add' method='POST'>
    <a href='javascript:;' onclick='addTextBox()'>Add New Field</a> <!-- new textfield/textbox will be added dynamically everytime the user clicks</a>
</form>

so basically i should do something like this in the serverside:

for ($i = 0; i < totalTextBoxes; ++i) { // iterate every textbox in the html form
    mysql_query("insert into `books` value (textBoxName[i]); // for every textbox save it into a new row in the table}

the problem is, since i created the textbox dynamically using javascript, how can i tell php how many textbox that i actually have there?

Dynamically Populate Drop-down List And Dynamically Include Html File
We have a drop down list on a PHP page, with several product names, and
when people click one item, we will refresh the same page with the
product name as parameter, and in turn we want to include a HTML file
into the content area of the same page.

I know it is recommended to put everything into database, but we want
the web site to be very "portable", so the drop-downlist and the
content should both in text files.

Let's say the drop-down list will be poplulated from the product.txt
file, and there will be a file for each corresponding item in the
drop-down list. From the user point of view, if he wants to add a new
product, he will just need to open the product.txt file, and add a new
line with the product name, "Laptop", then add a new text file named
"laptop" in the same folder which contains the HTML fragment to be
included in the content area.

What is the easiest way to do this?

Change Data On The Same Page To Something Else
I'm trying to change data on this line of code using a drop down option box.

map.centerAndZoom(new GPoint(-79.89505, 40.85708), 10);

When the page opens I want the above data to be used.

I want to use a drop down menu to select a different radius. Lets say 30 miles. I want to update the page so that the above line of code will update and look like this.

map.centerAndZoom(new GPoint(-79.89505, 40.85708), 30);

Here is some sections of code I am using.

<form action='<?php echo $_SERVER['PHP_SELF'];?>' method='post'>
<select name="radius" class="selectBoxes">
<option value="20">20 miles</option>
<option value="30">30 miles</option>
<option value="40">40 miles</option>
</select>
<input type='submit' name='submit' value='Click To Update Map'>
</form>

<script>
map.centerAndZoom(new GPoint(-79.89505, 40.85708), 10);
</script>

Change Data Time Format
when I retrieve my date and time from database and display as follow: 2003-03-14 14:42:18
How can I easily change the format into : Mar 14th, 2003, 2:42pm

Refreshing A Page To Display Change In Data
I have a page that scrolls out information from a database. When one
of the records has been completed by the user, they press delete at
the end of the row, and it sends the record id to a processing page
that deletes that record from the database, then returns to the
scrolling page. However, the deleted record still shows on the page
until one presses the refresh tab on the browswer.

Is there some way I can have the page refresh when the processing is
done, so that the changes made will be reflected immidiatly, instead
of the user having to press the refresh button themselves?

Change Format Style For Datetime Data Type
I don't know how to change the default format style for datetime data type.

When I retrieve data from a table the datetime fields are displayed as "day_number month_name Year" but I need it to be displayed as normal form: "month/day/year".

I have been trying to do it using setlocal, but I don't know how to use it.

Change Website To Php,mysql Data-driven Website
At the moment this site is not completely php. How can I make the content of the pages be from a mysql database? and how do I make the nav buttons work correctly connecting to the mysql database and displaying the correct content, ?

How To Change One Page To Change All?
i need to know how to create a page where i only have to change one thing on one page so it changes that text or image on every page of my site. in other words i want to be able to create a template, so if i do want to vchange something in the duture, i only have to change on page, instead of changing each individual page.

How To Dynamically Name Variables?
Lets say I have variables named: name1, name2, name3, and name4. How can I call them without having to name them everytime. Something like

for ($i=1; $i<=20; $i++){
if $"name".$i {
do this }

I've tried everycombination I can think of, but am totally confused. I had no trouble naming the variables dynamically in a form, but I can't get php to call them dynamically.

PHP To Dynamically Generate XML
I am interesting in using PHP to dynamically create an XML document and
then use XSLT to transform to XHTML. I have come across two methods for
doing this. I made two equivalent examples so you can see what I mean.

http://members.shaw.ca/petermichaux...SLT_method.html

I am interested in critisim of how I implemented each method. However
my main problem is deciding between methods. Which method is better for
bigger programs where the bits of the XML data are assembled by various
php functions that I write?

For example, one php function queries a database table for a list of CD
titles. A second php function loops through this CD title list and gets
the track listing for each CD from another table in the database. Then
the composite XML data (ie. CD title and tracks as nodes) can be
tranformed to XHTML.

Dynamically Naming Variables
i have this script for that uses 7 pulldowns for the time of an event each day of the week that gets inserted in to a db. Instead of writing the script 7 times for taking the data from the pulldowns, creating a time based on the hour, minute and AM/PM -can i create something that dynamically creates varibles. Basically takes something like $hour1, $minute1 and automatically creates $hour2, $minute2 and so on. This is kinda difficult to explain, heres a snippit of code which i want to duplicate.

Dynamically Incrementing Arrays
I tried searching for this, but couldn't find exactly what I wanted.

Dynamically Creating A Crontab
Is it possibe to dynamically create a crontab. Say i have a form to enter minute, hour, day, etc... and wanted to create a cronjob that ran to those values. Has anyone done this?

Dynamically Resizing An Image
I want to create a thumbnail image. But I don't want to physically resize each
image before uploading it (actually, my client doesn't really have the capability).

Can I dictate a height (i.e. 108 px) and have a PHP script that will
proportionately size down the image using that height? So, if the original is 360 px wide by 540 px high, the image will automatically size to 108 px high by 72 px wide.

How would I do this?

Dynamically Generate Mp3 Clip
I have page in which user will upload song and i need to automatically
generate a 30 second clip of the uploaded mp3 file and save it

can anyone suggest how to do this on linux server which software to use

is it possible with ffmepg or ffmpeg-php to cut a 30 second clip or 60 second clip etc.

if you have any example then please show me how to do that.

Find Domain Name Dynamically
I have 2 registered domains, which point to the same web root folder.
I would like to display a different logo image depending on which domain the user requested. Is it possible to find the domain name with PHP?

Dynamically Generate Mp3 Clip
I have page in which user will upload song and i need to automatically generate a 30 second clip of the uploaded mp3 file and save it. can anyone suggest how to do this on linux server which software to use? is it possible with ffmepg or ffmpeg-php to cut a 30 second clip or 60 second clip etc

Updating BIND Dynamically
I am about to start an indepth project for the company I work for. We want to use a PHP front end and be able to make updates to DNS dynamically. I was wondering if I can get some opinions on where to start.

Dynamically Populate PDF Form
I found a free script/class online a few months ago which enabled me to populate pre-built PDF forms with data using PHP; without using any toolkits etc (it worked perfectly). It was simply a PHP script. I lost the script when my PC died recently DOH!

Does anybody know where I can find such a script again? I have searched google all night, but all I find is commercial products (not cheap!) or toolkits for generating PDFs', not filling pre-built PDF forms. Here is what I am trying to do:

I have built a site for a client which incorporates e-learning. Students take lessons and if at the end of the course their grades are sufficient, they download a PDF certificate. The certificate is in PDF format with Form Fields for the required data. The certificate needs to display the students name, grade and course name. I need a PHP script which can import server-side data into a PDF form which the user can then print or save (flat). The last (and lost) script did this so I know it is possible.

PHP To Dynamically Make New Pages? DOH!
I am building a CMS system for a client to edit add and remove content from his new site, not a problem however he now wants the facility to create new pages and be able to edit the new pages, how do you create a new page dynamically using php and mysql?

As in he needs to make a new page called untitled2.php for example, with the title at the top of the page, a description about untitled 2 and then save the newly created page so it appears in the menu and actually exists in the remote server files, then be able to edit this using the CMS system? ERM...

Any standard commands as in create_page()?

How would I make the new page have variables included so that it could echo mysql content onto the newly created page?

Dynamically Transparent Gif's
Basically what i would like to do is dynamically set the transparency of a selection of images (GIF'S) depending on variables set in a My SQL Database. What i need to do is tint some jpg,s by setting the transparency of a solid blue gif which is set over the top of it in a table.

How To Append A Child Dynamically
i m new in both things php and in this group.
but i have some basic knowledge of php and DOM in php.

here is my problem,
i have one textfield for add a new main node (not main like:
<root><this_one></this_one></root>) in my php page and i m able to save
the xml file correct with this, and in the bottom of that i have one
new textfield for add new child in dynamically create node (which i
descibe above),and one combo box for show the all dynamically create
nodes.now i want that when user give the value in child textfield and
then select a root node for that child from combo box.i want to append
a child dynamically to root node.

but i m not able to do this. plz try to solve my prob...

Managing Subdomain Dynamically
i don't know if php can do it, here is the picture, what i want is a cheaper way of doing this stuff, newdomain.mydomain.com, cuz when i use the feature of the ISP, it will cost me $1/subdomain per month. any ideas?

Dynamically Load A Class
I want to dynamically load a class using a variable, e.g.

$module = new Mod_{$tmp_Name} ();

Where $tmp_Name is the name of the class.

Is there anyway to achieve this kind of thing?

Dynamically Embedding SWF File In PDF From PHP
is there by any means can i embed a swf file and export the same to a
pdf from my script.

Creating .m3u Files Dynamically
Im looking at creating a playlist program for my server.  i have alist of files within my database, and i wanted to be able to place these values into a playlist file.  the problem is that i dont know how to get the database to create the playlist form its records.  ie, if i uploaded a new file to my server and into the database, then i woudl want the script to automatically grab that file ( SQL  i know), anbd the nplace it in the m3u file ( i dont know).

Coudl someone recommend a simple method to complete this?  or point me in teh righ t doirection for a tutorial?

Dynamically Updating Database
I have drop-down menus created on a previous page, created dynamically so the number of them varies. When the form is submitted I need a script that will automatically add 1 to the value in the playerTries column in the players table, for every drop-down menu. I've tried the code below but don't fully understand what's happening, and why it's not working. Code:

Creating Queries Dynamically
I've been struggling with a problem for a while and I think that the solution lies in the ability to create queries dynamically. On one page I have a number of drop-down menus created dynamically, so the number of menus can vary. Each drop-down represents a try/touchdown scored, and the user would select from the menu who scored it. On the next page I want to take the info entered and send it to the database, automatically creating new entries for each try/touchdown scored. Code:

How To Get Value From A Dynamically Created Textbox
how to get value from a dynamically created textbox using php

Editing MP3s Dynamically
I'm trying to work out if there's a way of using PHP to dynamically edit an MP3. Is this a bit too much for the old PHP to handle? I just want to cut it down to 10 seconds of audio if possible.

Dynamically Create New Web Page
i'm making a cms, and I have a good portion done, I have it set up where the admin can log in and create a new post which goes to the database. I am just wondering how I can make this post a new web page? I have been trying to study how they do it in wordpress but with no avail. Anyone have any suggestions?

Dynamically Populate A Drop Down Box
I have a website with products for sale and along side each item I have displayed the number of each of these items that are left in stock.  What I want to do is to have a dropdown box so that the user can choose the qty of itmes to order but they should not be able to order more than what is in stock.

For example if there are 5 items left then the drop down box must be initialised at 0 and show the numbers 1,2,3,4,5.  When a purchase is made then the drop down must be adjusted to match what is left in the database. Code:

Dynamically Naming Variables
I'm pulling values from a db, the values are all domain names. Is there any way after pulling them in with a while loop, that I can define a variable name as the value of what I have pulled?

$query = "SELECT city FROM cities ORDER BY city";
$results = mysql_query($query);
while ($row = mysql_fetch_array ($results, MYSQL_ASSOC))
{
           $thisiswhereIwantTheValueToGo = $row['city'];
}

I understand that the above will make the value of the variable = to the $row['city'], is there any way I can dynamically create the variable name based on that same value?

Add Fields To A Form Dynamically On The Fly
I'm looking to create a form the allows the user to input a simple list item by item. However I am not sure how to implement a form that allows the user to add as many fields as the need on the fly.

Dynamically Create And Save Php Page
Here is my code:
$filepointer=fopen("http://www.mysite.org/usersetup/newusers/" . $SESSION_UID . "/configsite.php", "w+");

$data = "<? $name = ' . $datatosave. '
?>";

fputs($filepointer, $data);

fclose($filepointer);

My goal is to dynamically create a .php file with the contents of
<? $name = "variable data"; ?>

My code doesn't work. Something with the php page, I think. I and using similar code to populate .txt files with dynamic data, without variables, and it works file. Apparently, a quick change to .php is harder than I thought. I"ve even tried sending a simple line of data to the php page with no luck. Heck, I even tried doing it as a text file and rename to .php but it didn't like my rename.

Dynamically Generated Results Table
I'm trying to write a script that dynamically generates HTML tables depending on the results from an SQL query. So far, I have managed to set the HTML table headers to be the same as those in the MySQL table. [thanks to rod k -cheers !]

Now i'm trying to put the results in the table. Basically, I need a MySQL function to retrieve data and put it into the table until there is no data left....

(At the moment I am using "mysql_fetch_array()", but with this it is necessary to know the names of the columns to retrieve the information for each result set. Since my table is dynamic and should be able to build itself from different MySQL tables, the column names aren't fixed and so i can't use this to put the data in the tables...)

How To Dynamically Generate Functions In A Class
I am having to be tasked with a rather painful task of updating an
existing class by adding a dynamic amount of database field values;
for each database field value there has to be a generated array inside
the class plus a function "get method" to return it.

I do not want to have to constantly type out:

function getStuff() {
return $this->stuff;
}

for every occurrence of stuff I find that is generated by the database
SELECT call on the fields of as many as 20 different tables!! This is
enormous and I would love a more dynamic, functional method to
generate.. methods.

Saving A Dynamically Created Png Image
I have a web site that responds to a user request by sending an image generated dynamically. the request page call is something like this
<img id = "picid" src= "generateimage.php?$picName">

Where $picName holds the parameters needed for a particular image

generateimage.php sends the request to the server which generates the image as $pngstr and responds:

header("Content-Type: image/png".chr(13).chr(10));
header("Content-Length: ".strlen($pngstr).chr(13).chr(10).chr(13).chr(10));
echo $pngstr;

Now, I want the user to be able to right click the image and save it with a given name - related to but not exactly $picName, as a png.

I also have a set of images forming an animation generated in much the same way as the single image described above. How could I have the user save these? is there an animated png yet?

How To Get Full Address Of The Website Dynamically?
how to get full address of the website dynamically?
like www.yahoo.com/op/guy/123/
using server var($_SERVER).

i just want path till current working dir from www.yahoo.com/op/guy/123/ page.php i don't need it.

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.

Dynamically Generate MySQL Queries
what I expect will be a
reasonably simple question.

I have an html form (which is generated in php) which contains a
number of rows (one row per product in the 'products' table).

It is generated with the following php

<code>
// create a table for the results
echo('<table border=1 cellpadding=2>');
echo('<tr> <th>Product Description</th><th>Sales $</th><th>Sales
Units</th><th>Credits $</th><th>Credits Units</th> </tr>');

// add the results to the table
while ( $row = mysql_fetch_array($result) ) {
// get columns from the output on the current row
$ProdDesc = $row['ProductDescription'];
$ProdID = $row['ID'];
// write content collected above into table cells
echo('<tr><td>');
echo($ProdDesc);
echo('</td><td>');
echo('<form action="update-db.php" method="post"><input type="text"
name="sd');
echo($ProdID);
echo('">');
echo('</td><td>');
echo('<form action="update-db.php" method="post"><input type="text"
name="su');
echo($ProdID);
echo('">');
echo('</td><td>');
echo('<form action="update-db.php" method="post"><input type="text"
name="cd');
echo($ProdID);
echo('">');
echo('</td><td>');
echo('<form action="update-db.php" method="post"><input type="text"
name="cu');
echo($ProdID);
echo('">');
echo('</td></tr>');
}
echo('</table>');
//the table is complete
</code>

The values sd1, su1, cd1, cu1,...... cuXX are all available to the
update-db.php page which is called when this form is submitted so I am
fairly sure this is working correctly.

So far, so good, but when it comes to inserting the data into the
database I have not been able to create the SQL dynamically (in
testing I know the number of products and have manually written lots
of SQL INSERTs but this will not work in the real world)

The SQL needs to look like roughly like this:
mysql_query ("INSERT INTO sales_dollars (SaleID, ProductID,
WeekCommencing, Sales, Credits) VALUES ('',
'$prodID','$WeekCommencing','$sd1', '$cd1')");

My logic was to say something like this (which needless to say doesn't
work !)
<?php

for ($prodID = 1; $prodID <= $prodCount; $prodID++)
{
$currentSD = "sd" . $prodID
$currentSU = "su" . $prodID
$currentCD = "cd" . $prodID
$currentCU = "cu" . $prodID

mysql_query ("INSERT INTO sales_dollars (SaleID, ProductID,
WeekCommencing, Sales, Credits) VALUES ('',
'$prodID','$WeekCommencing','$currentSD', '$currentCD')");
}

I may have messed up the for loop here but the real problem was that
query would insert '$sd1', '$sd2' etc as text strings into the
database rather than evaluating $sd1 to it's value (passed from the
original table which would be a number)

I have tried using eval() with no success (though that may well be due
to my complete newbieness with php). I have also tried passing the
values from the original html as arrays and trying to use simillar
logic as above to read from $array[$currentArrayElement] also with no
success. Again, if I manually echo the results of $array[0] I am
returned the value entered in the first html field but I can not
dynamically select the next array element.

I hope I have made sense of the problem without writing unnecessary
garbage.

Populating Dynamically Generated TextFields
If one assigns something to the value iattribute off an input /text field, that value will be displayed when the form is loaded. My problem is, when building a form dynamically, the only way I can get the text to show is by doing the above, however, as this is an update form, when the form POSTS to processUpdate.php,
both the data entered by the user AND the data in the value attribute are inserted/updated.

So, how does one dynamically build a form where the data is displayed in the text fields but value atttribute is not set. PHP Code:


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