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




Drop Down Based On First, Working, But How Do I Keep The Value If Page Reloaded?


I have a drop down list that is populated via MySQL. Once an item is selected a second drop down appears, again populated by MySQL. I know how to keep the value for the first drop down, if the page is reloaded.... but the second one is where I am having the issue.

Is it possible to have a page reload and echo not only the first dropdown value, but also the second within the <select> tags?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Setting Drop Down Based On 2d Array
I have an array as follows:

$arr_subtype[0][0] = "Jam";
$arr_subtype[0][1] = "Custard";
$arr_subtype[1][0] = "Not applicable";
$arr_subtype[2][0] = "Pie";
$arr_subtype[2][1] = "Cake";
$arr_subtype[2][2] = "Sweet";

If the value of the first element is 0, I want to display Jam/Custard in the drop down, if the first element is 1, just display 'Not applicable' and if first element is 2, display the Pie,Cake and Sweet values in the drop down.

I also have values for the 2 array indexes in variables, based on when user has selected a value. So when the form is redisplayed, it displays the existing value.
$index1 and $index2 are the variables for the selected values.  Where $index1 is a higher level list earlier in the code.

The first entry will also display a 'Select type' initially, when the form is first displayed (before they have selected anything). Code:

Generic Data-based Drop Down Menu
This is becoming incredibly frustrating...

I have a pile of drop downs on one page. They are generated based upon tables in a database. After searching, the user needs to be able to refine their search. They click a form button and go back to the original search page with all the fields retaining the values of the original search. Everything works GREAT except my drop downs! They refuse to remember anything!

PHP Upload Files Drop Into A Directory Based On The Name Chosen
I am using the existing upload script and would like to add the ability to have the files drop into a directory based on the name chosen from the drop down list on the form. Currently all files drop into the same directory all the user is notified via email. I want to keep the email notification ability. Code:

Chained Drop Down List Working Example
Could some PHP guru please help me? I looking for a good working
example of chained dropdown list.

Can't Get Username/password Mysql-based Retrieval Working
I can't seem to figure out how to set up a MySQL-based password and username php app. Here's my code, it just goes blank when I run it and I can't figure out why. Code:

Redirecting To Page Based Upon Usename
Is there any tutorial or code where i can find the the information on how to redirect to a page depending upon the user. For example

The first page has a form which contains username and password, after submit it is redirected to page base upon the username.

Such as if the user is john then it will direct to john.php or user joe will go to joe.php.

PHP Drop Down To Redirect URL On The Same Page
I have a "Go" button and drop down list of the following:

Yahoo
MSN
Google

How do I link the Yahoo to www.yahoo.com, MSN to www.msn.com and Google to www.google.com upon pressing "Go"? The redirect will display the website on the same page.

Change An Image Based On Landing Page - Possible?
I have 2 landing pages and I need to display a different contact phone number as an image for each page.

The thing that's got me thinking is that I need this image (which is in a standard header file) to stay the same for each visitor across all the pages on my site, depending on which landing page they came in from. I need the phone number image to stay the same for 30 minutes even if a user revisits one or more of the landing pages within that 30 minutes.

So is a visitor comes in from landingpage1 they see phonenumber1 throughout the site for 30mins - if a visitor comes in from landingpage2 they see phonenumber2 across the site for 30mins. What would be the best way to do this? php? javascript? would it need cookies?

Multiple Page Generation Based On Post-length
Ok, first I'd like to apologize if this has been covered before, but I couldn't find it via the search options and it's been a long time since I've been here.

I'll give you a summary of what I'm trying to do, and you all can point me in the best direction on how to go about it!

I'm trying to design an online article posting section, where the members can post articles about things. The problem that arises imediately, is post length. What if someone posts a "3 page" article by word-processing-program standards, and then outputted this to the website? It would be a really long page and if the page was setup with a specific UI size design in mind, it would blow this apart.

I'm sure you can understand what I mean.

So, I need to be able to get the post's length, figure out how many pages I'll need to break that length up, then break it apart for output to the screen in segments with links for next page continuing the article.

Now, the post's length isn't hard, (strlen) and figuring out how many pages isn't that hard, dividing the post's length by the desired amount of characters wanted in the UI.

The part I'm stumped on is breaking apart the post into many peices that break at 'spaces' not in the middle of words, and that continue where the last one left off, not leaving any words out.

If this has already been covered, or someone knows of another site that has it, please post it!
If someone knows of a really simple way to do this, by all means, dazzle me!

Saving Selection In Drop-down Lists In PHP After Page Reload?
I can't find an answer to my quesiton anywhere.

Given a drop-down list with USA states and other text fields I pass
this information for further processing via PHP. If any of the required

fields is empty, the PHP script would return an error and reload the
form page asking to fill out those fields. All entered information is
saved... except for the drop-down list selection. I tried to write a
Javascript function which is echoed by PHP, but interpolation of PHP
variables in the Javascript section gives a syntax error message in
Javascript.

The PHP script returns, e.g., an "AL" string for Alabama. Of course, I
don't want to write PHP code for each option to make it selected.

Two PHP Scripts On One Page Not Working?
I have two small PHP scripts running on a test page

Both scripts work perfectly when there is one script on a page. However, if I place two on the page (one above the other), the second script will not render. I get no PHP error messages - the script will just not render.

I think the PHP Scripts are OK as they were automatically generated by RSS Feed Burner and both do run separately.

There may be an issue with having separate calls of some kind on the page or my server might not be set right. I did a server test that I think shows that it is OK but I am not sure. The only think I have in my htaccess file for PHP is: "AddType application/x-httpd-php .htm .html" .

I am new to PHP and was wondering if anyone can see why both scripts will not run together?

Calendar Page Not Working (in IE)
I have been hard at work on this one and my computer broke so I haven't been able to resolve this problem for a bit, I open the webpage in IE and it doesn't show up but in FF it shows up just fine, anyone able to give me a hand on this one, it was working fine awhile back but now for some reason it seems to have broken. Code:

Flash Not Working On Page
I have inserted Flash animation on my page as normal (using Dreamweaver)- only it won't display in the browser for this site - which has various php/mysql pages on it - but this one is a simple html page - which displays the html - but not the Flash ?

The flash displays in the browser if I insert it into a page on another site - which does not use php/mysql.

Is it to do with the set up of the site which uses php/mysql ? - e.g. the fact there's testing server settings. My sites/servers are hosted remotely - and not on my own machines.

I Can't Get Info.php Working On PWS Win98 The Page Cannot Be Displayed
Can someone help me?
I have tried php-4.3.4-installer
I have tried php-4.3.4-Win32
If someone has PWS running PHP4 on windows 98
I would appreciate any help. thank-you

Php Code Embedded Inside Html Page Not Working.
How do I make or workaround in my Apache server to parse *.html files
for
<?php ?> code embedded in it?

Currently php recognises <?php ?> tag only if the file has a *.php
extension. Any php code inside *.html or *.htm is ignored.

Since I dont have admin access to the server or admin person, changing
the php configuration is out of choice. Now I have to go thru echo
and print statemnets to get it work. But it looks very cumbersome and
prone to errors.

Drop Down Lists Changing Depending On Other Drop Downs
I want to have a drop down system like this one.  But without the radio buttons.

I want to have 3 drop downs but have no idea how to go about it.  I assume I will need to activate some sort of Javascript on the onChange event of the option drop downs.

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/

Sessions Working, Then Not Working?
I wrote a login script (one that I have used on quite a few sites previously) and have found that it was working, then not working, then working again now not working - all without me changing any code. Here is the process:

1) l/p gets sent to login.php to query the db

2) if login successful, set $sid = session_id, and other session variables, register them in the session, and redirect to main.php

3) first thing on main.php is check_login function, all this does is see if $sid is set and equal to the current session_id(). If succeed continue to display data on main.php based on registered user data. If fail, redirect to error.php with the appropriate error code. this all takes place on a shared ssl server if that matters.

The trouble I'm having is the check_login function is failing because no session variables are present, including $sid. I'm 99.9 percent certain it's not a code issue because 1) I have done this same script many times before with no trouble, and 2) this particular one was working before So I am really looking for php configuration issues to check on, or things like that.

Web-based PHP IDE
due to being a traveller with a constant problem of getting connected
to my server and update
or recode chunks of my site.
Web based IDE for php with login stuff so only i can edit my site...
I can of course create one of my own (read above - me = php developer)
but it takes time and effort... so i want to see first, if there's
something already made out there...

Web Based IDE?
I have been doing quite some php using UltraEdit and Eclipse. Now i
recently done another Smalltalk project i realize how i miss the
searching capabilities of a good IDE: definitions of- and references to
functions by name (called senders and implementors in Smalltalk),
preferably combined with wildcards and 'search for function name where
the cursor is in'. These are all available for Java in Eclipse, but not
for PHP.

Now i already have built all these seaching capabilities in the form of
our Hypercode Browsers, but once i have found what i searched for i
would like to press an 'Edit' button to jump to a descent code editor. I
could easily add a standard TextArea in the browser to get a simple Web
Based IDE, but i would rather have a good color coding editor. I could
adapt one of those fancy rich text editor components we use for our CMS,
but that would require a color coding algorithm, preferably in
JavaScript, and probably more JavaScript knowledge then i like to learn.

So this is my question: anybody ever heard of a dynamic html component
for web based code editing, that supports color coding? Or maybe a
complete web based IDE? Or maybe a way to make UltraEdit or Eclipse open
a specific file from JavaScript (or remotely from php)?

Web Based Email
I am designing a PHP-MySQL web based email and I have a question. How can I get the messages sent to a specific user. I mean how do I know if there is a new message in the mail server. And if I am doing the web-based email without POP3, how can I know when a new message arrives.

XML-based Configuration
Does anyone know a good way to retrieve data from inside of an XML file and use it for configuration within my PHP apps?

I tried PHPXConfig, and even with caching a serialzed version of the object, using the getData() method (you give it an XPath) makes my application a lot slower.

PHP And Web Based Mail
PHP can create application about web based mail.. like yahoo ,hotmail or not..?? Almost articles explain only view, read, reply, attached file function.. I would like to know how can php connect to mail server for creating new account for any user real time, does it can do..?

Php Based Crawler
The problem is, im trying to make a central portal so that all of ma frieds blogs recent post can be seen on it. so that its easy to see who posted wot and all...

the process needs to be that when i add a URL, the crawler then keeps cheking on the URL's. if theres a new post made it has to appear on ma central portal with the title and descriotion..

so is there a way to do this or any script out there that is currently doing this..

Web Based Email
I really need a web based email script. Something like hotmail is what I'm aiming for. Users have to be able to sign up on the web, and login to their account, exactly like with hotmail.

Web Based Mail
I want to make my discussion forum page become more powerfull.Let's say, if someone send an email,then the subject become the new topic's subject. and it will record the sender's name and the massage too.

Accessed Based Off Of IP...
There are certain scripts that I have that only I want to run, both from
home and sometimes work. If I add something like this (below) to the
scripts, will this keep out unauthorized use (if the scripts are found
somehow), or can the REMOTE_ADDR be easily spoofed ?

Should I be checking HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR also ?

$ip = $_SERVER["REMOTE_ADDR"];
if (($ip == "x.x.x.x") or ($ip == "y.y.y.y"))
{
//secret stuff
}
else
{
echo "<META HTTP-EQUIV="refresh" content="0; url=/index.php">";
die();
}

or something like this:

function getipaddress()
{
$ip;
if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");
else if (getenv("HTTP_X_FORWARDED_FOR")) $ip =
getenv("HTTP_X_FORWARDED_FOR");
else if (getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
else $ip = "UNKNOWN";
return $ip;
}

$ip = getipaddress();
if(($ip == "x.x.x.x") or ($ip == "y.y.y.y"))
{
//secret stuff
} else {
echo "<META HTTP-EQUIV="refresh" content="0; url=/index.php">";
die();
}

Drop Down Box
I have a drop down box that I have coded to have several values. These values are actually snippets for SQL code. how do I make the drop down box display the selection picked by the user after the page is refreshed?

Drop-down X 5
I am trying to populate a drop-down from a database and repeat this drop-down five times. The first drop-down gets populated but the others don't. I tried to reset the array, but I am still new to PHP and not sure if I am doing correct. Code:

Drop Down Box
The purpose of this application: I need 2 combo boxes, one with months, and one with years. When the user chooses both a month and a year, a page is displayed with certain numbers that are retrieved from a database. Those numbers correspond to the specific month and year. For example, January 1998 produce "12", but February 2001 might display "73".

So I guess I'm asking 2 questions. The first is just a general outline of how someone might go about doing this (to see if i'm on the right track in my thinking). The second, and more important question is for someone to please explain to me how do I get the values chosen in the drop down boxes to correspond to specifc fields in a database?

Drop Down Box
i've got a drop down box that is populated by the results of a mysql querie but for some reason it only shows the first word. so if i have the results;

test 1
test 2
test 3

it will just display test, Code:

Drop Down Box Other
Im trying to create a drop down box which at the end has a Other option. If Other is selected I want the variable which is set from the drop down box to be set to whatever is typed in, in the input box below by the user e.g:

<select name="team_name"><option value='' selected disabled>Select Team Name</option>
<option value="1st XI">1st XI</option>
<option value="2nd XI">2nd XI</option>
<option value="3rd XI">3rd XI</option>
<option value="Other>Other</option>
</select>

I dont really want to use Java or AJAX, is there anyway in which this can still be done?

Drop Down Box
I have a couple of drop down boxes which you select the option you want, that value is then stored in the database. If you make a mistake there is an edit option which once clicked shows the form with the information filled in/selected.

However my problem is that when you edit, although the current option which was previously entered into the drop down box is set as the starting value, which is disabled, if you dont change the drop down box the value is deleted rather than held as it hasnt changed. Code:

Ip Based Download Qouta
Is there a script that can block the site grabbers download my whole site?

or

How can i define an ip based total download file size quota for the visitors?

PHP Based Shopping Cart
Does anyone know of a basic (or more advanced) shopping cart out there
written in PHP that processes orders but emails the order to a store
owner rather than process the payment? I have a specific need for such
function and don't mind installing a more full featured cart as long
as I have the ability to disable the online payment section. I have
access to a MySQL database so that is not a problem if it requires
one.

URL Based Redirect Script
I've parked 3 domains on one hosting account. I'm fairly sure that to have the domains pointed to their own separate directories, the host would charge me extra, so what I've done is set up separate index pages for each domain, and am now trying to create a page that will redirect the user based on what URL they typed in or clicked on to get to the site.
The Problem is Nothing seems to work! At first I was going to just use $HTTP_REFERER, but some browsers don't use that (mine included). Then I was going to use $HTTP_HOST, but it doesn't seem to match up with the strings I'm using. I read another thread where someone mentioned installing PEACH or Apache modules to do this, but since I'm using a virtual host and am kind of trying to avoid paying extra fees, I don't know how keen they'd be on that.

Is there something I'm doing wrong with the HTTP_HOST variable that I don't know about? Does anyone have any suggestions on a better way to do this? Php code:

Run Time Based PHP Scripts
I'm trying to develop a reminder service, which should send emails when an event ia about to happen. I've a script which when executed, checks for the dates and send emails.

Now, i wonder if there is any way to automate that. So, that script should get executed on a daily basis automatically. Is there any way to time this type of PHP script?

Regarding Top 10 Php Based Frame Works
I new one for this group .Now am working php for last 2 years.I want
learn and use php based frame works .Please tell me top 10 good and
famous php based frame works.


My Two (php Based) Web Sites And Xitami
I test locallu my two web sites (php based) with witami web server.

It is not easy to work with two different web site or it is easy abd I wrong
somthing to do it.

Please how can I do to work best and having the possibility to call
separately locally my two web site?

Referer Based Allow/disallow
If referrer is internal (www.mysite.com), then show the page, else show an error message.
Basically do not want outside link, and would prefer not to have direct link through the browser either.

Graphics-based PHP Counter
I ask because the only method I've found of getting my graphics-based PHP counter to work is in a frame, and I can't use <IFRAME because the folks with older browsers (Netscape) cannot see it. There is a method using <DIV tags but something is off in the manner I am using it in, because the browsers (both IEx and Netscape) show a broken-image link graphic in place of where the counter should be. Here is the snippet:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<DIV align=center>
<img src="http://www.myisp.com/mypersonaldir/mycounter.php" border="0" width="160" height="80"></DIV>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.

How To Write Php-based Forum
I'm writing some webapplication and it would be desirable to add the
forum there so the intended people can discuss the problems there.

I'd like to create forum with a structure like a it works in Google
groups.

Can anybody advise me some samples how to write php-vased forums?

Time Based Event
I'm trying to get a single quote to display once per day. The quotes are actually the subject lines of posts made on a forum board. Right now, I can get them to display just fine picking a new one on each page view. I'd like to get it so it sets one quote per day, and doesn't display a new one until the next day.

I have a settings table, so I was thinking it could work something like this:

1. I initialize the script and create the rows quotetime and curquote in settings. After creating the rows, the script will put the first quote and current date in the value column.

2. In my function, it'd be something like PHP Code:

XML-based Template Engines
Does anyone know of a PHP template engine that uses XML-compliant syntax? I
mean something along the line of having <template:variable name="myVar" />
instead of the usual {myVar}.

Intranet-based Calendar?
I'm interested in creating an Intranet-based calendar which will contain company information such as holidays, special events, etc. I was wondering how this could be done. I was originally thinking of using an ActiveX control of some sort but would rather use DHTML w/ Perl/PHP instead.

Web Based Mail,qmail
i want to develop a web based mail like hotmail and yahoo using PHP. i have only POP. how do i do it. where are the read messages stored? - database or files? Also my server has only qmail and not sendmail. is qmail supported by php mail function.

PHP Password Based Upon The Hour
I am in need of a way to password protect a directory with a generic
password that changes with the date/time. The only problem is that I
don't want to .htaccess or MYSQL - only PHP.

Redirect Based On What They Typed In
Imagine your web hosting provider just permitted you to type
*.mydomain.com and you still get to the mydomain.com website that they
host for you. Imagine you want to setup websites for your family like
dad.mydomain.com, mom.mydomain.com, etc.

Well, this is a request and some information for you. First, here's
how you could use PHP to react to what they type in the URL:

<!-- save as index.php in /var/www/html on Linux Apache: -->
<?php
$headers = getallheaders();
if (in_array('dad.mydomain.com', $headers)) {
header('Location: http://www.mydomain.com/dad/');
exit;
}
if (in_array('mom.mydomain.com', $headers)) {
header('Location: http://www.mydomain.com/mom/');
exit;
}
?>

So imagine your workstation is where you're developing and testing
this. What changes would you make to /etc/hosts, Apache, or something
else on your Linux system so that it accepts *.mydomain.com?

So, the request -- the reason I ask is I want to inform my web hosting
provider of the changes they can make to their Linux system so that I
can start using this PHP index.php script to redirect to various
websites under mydomain.com.

For now, in experiment mode, I had to add dad.mydomain.com and
mom.mydomain.com to /etc/hosts for 127.0.0.1 to get this to work. But
I wish I could do something dynamically.


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