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


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Combo Box Value On Page Reload


I am new to php and mySQL so this is probably something very basic that I'm
missing. Basically, on the page I have 2 combo boxes but 1 of them is not
getting the value passed when the page is reloaded so the database can be
updated. I am echoing the field names passed and the field "theDriver" is
there but it's empty. I've include the code parts where I believe the
problem should be but I'm stumped and I've been trying to solve this for 2
days without success. Would someone mind examing the following code and
tell me what I've done wrong?

Following code constructs the combo box on the page from a MySQL table:
<?PHP
$table = "tblEmployees";
$Link = mysql_connect ($host, $user, $password);

$Query = "select concat(empID,' ',empFirstName,'
',empLastName)
as full_name from $table WHERE empTitle =
'Driver'";
$results = mysql_db_query($database, $Query, $Link);
?>

&nbsp;&nbsp;&nbsp;&nbsp;<b>Driver:</b>
<select name = "theDriver" size="1">
<Option Value=" ">Select One:</option>

<?PHP
for($u=0;$u<mysql_num_rows($results); $u++)
{
$driver=mysql_result($results,$u,'full_name');
?>
<option value="<?PHP echo($ID); ?>"><?
echo($driver); ?></option>
<?PHP
}
?> //end php

</select>

When Page is reloaded the following code is run but the combo box titled
"theDriver" is empty

foreach($_POST as $field => $value)
{
echo $field; //field names from form
echo "; ";
if ($field == "theDriver")
{
echo " - here's the driver for ya: ";
$$field = strip_tags(trim($value));
echo $$field;
$pos = strpos($driver, ";");
echo "<br> the ; is in pos $pos <br>";.......




View Complete Forum Thread with Replies

Related Forum Messages:
Can Header() Do A Div Reload Without A Page Reload (ie Ajax-type)?
I have a display page (displaypage.php) divided into two panes - one for content and one for feedback, referred to in the CSS as contentDiv and feedbackDiv respectively.

When I click on a word in the content pane, I do a PHP/PostgreSQL search for similar words, and the results appear in the feedback pane without a page reload. For this, I am using a very basic Ajax setup Code:

View Replies !
Session Var Is Setting ONLY AFTER I Reload Page, Form Var Displays First Page Load
Page1 has a form that calls Page2. The beginning of Page2:
<? php session_start();
$s=$_POST['sSelected'];
session_register("s"); ?>

in the middle of Page2 I have a form varaible:
<?php echo $_POST['stateSelected']; ?>
<?php echo $_SESSION['s']; ?>

The form var displays the first time the page loads. The session var
displays only after reloading the page2.

View Replies !
How To Pass A Combo Box Value To Next Page?
i've a combo box filled with values. i need to pass the value of the selected value to the next page.

View Replies !
Page Reload
I have succesfully created a login page for my site. I have used the PHP_SELF
so that once the user has succesfully logged on the page reloads. Everything
works fine the first time somebody tries to log in but when they revisit, the
log on page is bypassed and it goes straight to the information page. I have a
sneaky suspicion that this is due to the fact that the page is then in their
history of recently visited sites. How can I use PHP to refresh the page
automatically everytime it is requested?

View Replies !
Reload Page On Die
I have a query that seems to fail about one out of five times, resulting in a completely blank page. Here's the query and the call to it (which appears before any HTML is displayed): PHP Code:


$query = "SELECT msg.id, msg.to, msg.from, msg.subject, msg.date,
  u1.first_name as to_first, u1.last_name as to_last,
  u2.first_name as from_first, u2.last_name as from_last
FROM messages msg, userprofiles u1, userprofiles u2
WHERE msg.read = 'n' AND u1.id = msg.to
  AND u2.id = msg.from AND msg.to = '$userid'
ORDER BY msg.date DESC";
$reslt_message = mysql_query($query, $conn) or die(mysql_error());

If there is anything wrong with this query, please let me know. Otherwise, assuming that the query is ok, would it be wrong (or even work at all) to put a header inside the "die" that reloads the page, or would that be bad practice? I can see the possibility of getting an infinite loop, but that could be remedied by adding a variable to the end of the header that would force the code to reload only if it hasn't reloaded yet. if that is clear. When the page crashes, refreshing it works. If I click the link to this page 10 times, it could be the 1st or 10th time that results in a crash, so I'm thinking that the query is ok but it is having trouble processing it or something, which is what led me to think about reloading the page.

View Replies !
Reload Php Page
I am creating (using php) an html page with many links. Clicking on a link open the link as _self. Clicking on the browser back button brings the prv html page (with the links,) but instead of getting it from the cache it will recreate it. how to avoid the re-creation of the php/html page and just to reload it from the cache.

View Replies !
Reload Page
I have a form which is used to add / edit records in a mysql db. This all works fine but after entering a record, and returning to a database view page, a user can hit reload page and a new record is added. Clearly, the previous $_POST vars are still in the system and thus reloading the page runs the same script to add a new record.

View Replies !
Reload This Page
I'm trying to create a cookie on the user's machine that includes the referral url. I then plan to call the data from the cookie in a script that is called on my thank you page to track sales. Why won't the following script work? It's writing "$_SERVER["HTTP_REFERER"]" to the cookie instead of the referrer URL.

<?php $value = '.$_SERVER["HTTP_REFERER"].' setcookie("solvotrack", $value, time()+2592000); /* expire in 30 days */ ?>

View Replies !
Page Cache/reload
I have created a facility for users of a site to enter details of property (e.g. location, size etc.). This allows them to upload a picture. Users can also update a picture, adding a new picture to replace an existing one.

My problem is that if a user changes/updates the picture and then views the details the old details are displayed unless the user manually clicks refresh.

I know that this is because IE is storing the page in cache. I have tried the Meta Tags with "no cache" and "expires" but they don't work. I have also tried to get the page to refresh itself on loading, but it either doesn't work at all or keeps refreshing over and over again. Ideally i would like the page to just refresh once and then stop refreshing but there doesn't appear to be any way of doing this.

View Replies !
Refresh To Reload The Page
i was using header("Location: http://test.com/alt.php"); on my php page as a refresh to reload the page as i need to refresh the whole page but hold my sessions i set to rest the forms on it.

but then i had to create a header redirection page in  the website to have get the websites template page on the page i created for the  menu logo  etc. so turning the original page into a redirection to achieve this.  So now my php page is in zen cart and is called in on the first the redirection nut when i try and use a second header location it doesnt work.

View Replies !
Page Reload With An <iframe>
Let me to explain the structure....

filename : api.php

Having an <iframe src="remotehost/index.php"> </iframe>

i have to reload current page api.php after some execution of remotehost/index.php ... I've tried header(); but got formal header error. can we reload current browser url from an iframed code?

View Replies !
Does 'Back' Reload The Page?
I notice that when I click the 'Back' button my previous script runs, i.e, all the php code runs (I previously thought that maybe the previous form displays without the code re-running).
However, I do not get the expected value displayed on my form.

After populating one element in formA with &#3917;' (just any number) and submitting to formB (using POST ---> Redirect --> GET to avoid the 'expired from cache' message) I then click the 'Back' button and the 17 does not appear. In the code below, after clickng 'Back', I see as output from the echo statement that rb_value[0] is, infact, &#3917;' but within the form, the text element named rb_value[0] displays as empty.

Does anyone have suggestions why this might be?

It might have to do with that I do not understand what the 'back' button does. Or maybe with my PRG (post - redirect - get) model.

Here is part of the code:
echo "rb_value[0]=".$rb_value[0]; //After clicking 'Back' I see that rb_value[0] is 17

if (isset($rb_value[0])) {
$rb_val = $rb_value[0];
} else {
$rb_val = 1;
}

$line.= "<td width="20%" valign="center" align="left"> ";

// This element displays as empty instead of the expected 17
$line.= "<input type=text name="rb_value[0]" value="$rb_val" size="25" maxlength=25 </center> "
$line.= "</td> ";


View Replies !
Increment ID In A Page On Reload
I have a page that has an iframe on it, PHP Code:

<iframe src="index.php?u=<?=$ID?>" width="400"></iframe>

What I need to do is on every page reload increment the $ID variable so I load the page

1 time then
$ID = 1

new page reload

$ID = 2


how can I do this?

View Replies !
Reload Same Page With New Query
how would I go about reloading the page with a new query by a click of a link.

right now its loading everything from my table,

SELECT * FROM usr_img;

I want to be able to click a link and have the page reload with,

SELECT * FROM usr_img WHERE img_cat LIKE 'Birds'

Can anyone help me, im still learning php.

View Replies !
Resubmitted With Page Reload
I am using PHP5 and IE 6. I have made a web form. The action attribute of the form is redirecting it to the same page. Like action="index.php" and form name is also index.php . I am using Post method. When the user clicks on the submit button all the post variables are check by the isset function and then only the function to insert data is executed. If the user clicks on submit first time the data is submitted.

View Replies !
Reload The Same Page With A Form After Submit?
I have a page with a form, and the code to process the form answers, I want the same page/form to just reload when the user presses submit. The only function I have found is that location command. PHP Code:

View Replies !
How Do I Force A FRESH RELOAD Of A Page
I've built a few php scripts, but since its reloading the same page I can't get it to refresh the page. I've implemented some expire meta tag...but is there anyway I can try and force it to refresh?

View Replies !
Reload (refresh) Page Within An If Statement
Is there a simple way in php to reload a page coded within an if statement.(see code below)It's very important that the session stays intact. Code:

View Replies !
Session ID Changed Everytime Go To New Page Or Reload.
I'm new member of this group.

I had added new virtual host at my intranet server. The new virtual
host configuration on httpd.conf is similar with the old one.
At the new virtual host, the session id seems changed every
interaction to server (new page or reload).
The old one is fine, the session id keeps at the same string.
Both are at the same server.
I use Apache 2.2.3 (Win32) with PHP 5.2.0.

Tested using code below:
session_start();
echo session_id();

PHP Configuration :
session.save_handler = files
;session.save_path = "/tmp"
session.use_cookies = 1
;session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
;session.entropy_length = 16
;session.entropy_file = /dev/urandom
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5

View Replies !
Stop File Reload When Page Is Refreshed
I have a section of PHP code at the beginning of the page that loads a file which the user has specified in the form, on the same page. The problem is that everytime the page is refresh with the refresh button, the file loads. I want the file loading to happen only if the user has pressed the submit buttom.

View Replies !
Reload A Page After Execution Of A Mysql-query In Php
I am aware that this question might involve Javascript and MySQL. So
far I haven´t found a suitable solution in JavaScript ng´s - maybe
becauese php-programmers are more likely to come across the following
problem:

A script on my page relays a quite complicated query to a MySQL-server
with mysql_query(...); The query works fine but takes very long - I
usually have to wait for approx. 30 seconds before the query is
returned from MySQL and the results displayed by php on a webpage.

I´d rather have the results of the query written into a nice textfile
and display a text like "Results are being retrieved" in stead of the
actual results and have the page reloaded a f t e r the textfile has
been updated. The newly loaded page then would obviously first check
whether this very textfile has been updated or not and read out its
contents in case it is has been updated less then let´s say two
minutes ago.

I hope I can make myself understood...:)

My question is: what actual code (I am almost sure it must be
JavaScript and not PHP) does PHP have to generate in order for the page
to reload after the results are retrieved and stored in the textfile?

View Replies !
Reload Outside Page OnClick Of Submit Button
I'm using frames to create a "bookmark-like" page. You can enter a URL and it gets added to my database. I have two frames (leftFrame - to display bookmarks entered and mainFrame to show web page). I want the leftFrame to automatically refresh when the user enters a bookmark. As of now you must physically refresh the page to see the results. Here's my code:

View Replies !
Make Sure The Page Reload Doesn't Affect Stuff
On my website I'm making I have a lot of stuff that happens when you load a page. Information is sent using the url string. If a user were to refresh the page on a page where I gave his account a special bonus, he would receive the bonus again and again. How can I counter this? Is there something that $_SESSIONs can help me with?

Is there a way I can change the extra PHP information in the url string and the form POSTED data to not be there if the user reloads the same page?

View Replies !
Preventing Multiple Data Insertion On Page Reload
I am developing a PHP-mysql database. It is noted that when the
browser window is refreshed the data is inserted again in the
database. unfortunately there is no unique keys that I can use to
verify the existance of the data, so as to prevent the multiple
insertion. Is there any other way to prevent it otherthan introducing
another field for this purpose and verifying its existance?

View Replies !
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.

View Replies !
$_SESSION Problem - Page Reload Creates New Session ID
I am having trouble using the session vars in
PHP 4.3.9
OS: Win XP Prof
Web Server IIS (is local and there are no links to other servers from
the web pages I work on)
Browser: IE 6.0

The problem I am having is that each time I reload the same PHP page, I get
a different
Session ID (and thus all session vars are lost from one page to another).

let's say in firstpage.php I set
$_SESSION["firstvar"] = "someval";
$_SESSION["secvar"] = "otherval";

and in secpage.php I try to retrieve $_SESSION["firstvar"] , it gives me
"Undefined Index error"
I did not know what is happening and when printing out the session id (echo
SID;) I found out
that the ID is changing every time page is reloaded or when moving to
another page.

The problem is that I don't know what might reset the session since I use
"session_auto_start"
and have not played with session_start, session_destroy or anything else.

View Replies !
Form Validation :: Reload The Page With Red Error Message
I wrote the following form so that if a user leaves a field blank the page will not process and instead be re-loaded with a red error message asking the user to enter the missing information: Code:

View Replies !
Ensure My Post Vars Make It Through A Page Reload.
A few of my users are occastionally getting the above message for certain pages. Reloading the page then allows them to continue but the $_Post vars seem to be at least partially absent.

1) Is there anything I can do to see what is causing the "Page cannot be displayed" message?

2) what can I do to ensure my post vars make it through a page reload.

View Replies !
Drop Down Menu - Every A Value Of It Is Selected To Reload The Page And Submit That Value.
i have a drop down menu and i want every a value of it is selected to reload the page and submit that value. i'm using something like this: HTML Code:

<select name="menu">
<option selected value="1">GENERAL</option>
<?php
while ($cat = mysql_fetch_array($q)) {
$cid = $cat[0];
$cname = $cat[1];
echo "<option value='$cid'>$cname</option>
";
}

echo "</select>";

i tried using <select name="c" size="1" onChange="MM_jumpMenu('parent',this,0)"> but i got confused so i'm looking for an alternative way..

View Replies !
Force Reload Of Page When User Press "Back" Button
Is there a way to force a page to reload if a user har pressed the "Back" button in the browser.

View Replies !
How To "reload" The Page Once The Vote Is Submitted And Show The Results.
I've created a nice little poll function for my site. The one issue I am facing is I don't know how to "reload" the page once the vote is submitted and show the results.

Basically when a vote is added, I'd like for it to refresh the index.php page and show the results of the poll. Code:

View Replies !
Refresh Page - Or An Absolute Refresh Not Reload.
If the image content for image1.jpg changes, but the file name image1.jpg
does not, IE6 does not show the new content unless F5 is pressed.

If I reload the page using http://domain.com/view_pictures.php the image
does not change.

If I use a header("LOCATION: http://domain.com/view_pictures.php"), the
image does not change.

I have tried several ideas to force the reloading of the image file with no
little success.

I cannot change the image file name.

Even if I add another a second image, the first image does not change.

IE must use the file name to determine if it should reload the file. But F5
works.

Is there a means in either php or JavaScript to call (force) a F5-keyboard
command? or an absolute refresh not reload.

View Replies !
What Is The Best Way To Use PHP To "reload" Web Page?
I am trying to code my "notfound.html" page when people click on the
link that will send them back to home page, that the "entire" browser is
"refreshed".

Reason for doing this. I have frames on the home page. When user click
on the link on "notfound.html", the home page appears within the home
page frame. So I see 2 home pages. I have to physically click on the
"reload" button on the browser to the the appearance that I want. But I
know that "common" user will not think of that, and will determin that
the home page is buggy...

View Replies !
Combo Box Value
On my site, if you click on a link i want you to be taken to a contact form that contains a combo box, but what I want to do is predefine what value of a possible five selections is set... What is the best way of doing this?

View Replies !
If And While Combo
I want to combine an IF statement with a WHILE condition.. They work fine seperate but i can't seem to combine them the way i want. Look @ my code so far: Code:

View Replies !
Combo Box?
how to make combo box link with my database? I want my data appear when drag down the combo box Can someone help me with the code i should use???

View Replies !
Combo Box
I am allowing users insert data into a database using a form. I want one of the fields "department" to display all existing departments in the database in a combo box for users to choose from and also have a field in the combo box for them to add a new department. Is there a way for me to do this in using php? I am using php to access the database.

View Replies !
Combo
I have a combo box :

<select name="stock" id="stock">
<option value="In Stock">In Stock</option>
<option value="Not in Stock">Not in Stock</option>
<option value="Discontinued">Discontinued</option>
</select>

I am connecting to the database and i want to display the results in a form and change the value of the combo box to the one value in the database for that record. How would i set the combo box to the correct value using php.

View Replies !
Combo Box With ALL
In a combo box, I have the user select a company name and that name is then sent to the query. What I am trying to do is if no selection is made, the query would still run as if all the selections were made, returning all the companies which fall into that category. Do you know how to do this? I created an <option>ALL</option>, but cant figure out what its value should be?

View Replies !
Combo Box And Sql
can any1 give an example of a query being called from a database in sql and the result being stored in a combo box in php?

The code for a normal combo box sending the value as item is show below but i want the options to be from specifically in the databse.

<select name="item">
<option>Paint</option>
<option>Brushes</option>
<option>Erasers</option>
<?php
$_POST['item'];
?>

View Replies !
Combo Box Values
I have values in a combo box where datas are coming
loaded dynamically. When an user selects a particular value and press search, even after refreshing the page, I want to keep the value same as the user selects. For example suppose if I selects
value PHP from combo box, after submitting the combo box should
value highlighted must be PHP. IS there any way I can do this?

View Replies !
PHP/MySQL Combo
How come sometimes I get the following error:

Fatal error: out of dynamic memory in yy_create_buffer() in Unknown on line 0

My code works most of the time, its a combination of PHP and mySQL, i have no function named "yy_create_buffer". And the worst problem with this error message, is that when that error comes up, its the ONLY thing that comes up.

Other error messages at least they show up inside my page and they say what I specify the error messages to say. This type of error message would look totally unprofessional on the site I'm developing and I'm curious is there anyway to prevent this or somehow pinpoint the cause.

I'm starting to lose faith in PHP/mySQL . I'm starting to doubt whether the PHP environment is effective for a search engine which searches what will be a relatively large database.

View Replies !
Selected Combo Box
i have the following code and i am having problems with setting the combox to select the value that is stored in the database. i am hoping that the combo box selects the value and the value from the database is stored in $title PHP Code:

<?php
function displayedit($id,$title,$fn,$ln,$instit,$depart,$email,$url,$room,$phone) {  
echo '
  <form name="editform" method="post" action="editform.php">

  <p class="body"><b>Title:</b>'

    $t ="Dr","Professor","Mr", "Ms"
    echo "<select name='selectTitle'>";
    foreach ($t as $value) {
     echo "<option value="$tvalue"";

View Replies !
Populating A Combo Box
Using php how can i give a combobox a default value when the page is loaded?

View Replies !
Make Combo Box
Suppose in the client side there is a table in which name of car manufacturer is given then if we click on it the different models of cars should come on he other list. give stepwise info.

View Replies !
$_POST & COMBO BOX
I just need the option chosen in another php file. i have the following peice of code in my index.php

<select id="papertype" name="papertype">
<option value= "0">Gloss</option>
<option value= "1">Gloss</option>
</select>

i need the chosen option in the details.php file (this doesn't work but here is what im using to try and call)

$desc= $_POST ['papertype'];

View Replies !
Combo Box To Submit
how do I use the combobox to submit the page to itself? I want to use the combobox to submit then when it opens itself again, the textfields below would be filled with data form the DB.

View Replies !
Need To Add A New Combo Box For States
Please want to add a new combo select box for states, once the country is selected, the states need to get populated in the states combo box.

Right now the current functionality is doing the following: when country is selected it is populating all the city names: I am attaching the files registration.php and registration_form.tpl.

View Replies !
Dynamic Combo Box
Iam working with a php, mysql program, In this program I have let's say 3 combo box (select tags) one for student_id , one for first name and the other for last name,

I already got data from mysql using( select * from student) and put them in these combos, but I need onchange of each one to execute another select statement (for example if we change first name select * from student where firstname=....), so I need to clear the other combos and refill them again according to the new query. so, I'll obtain all the students whose first name=...

here we need to call a function that makes combo clear using javascript (form1.fn.options.length=0) and also execute a new query(select * from student where fn=..) and refill combos again(new option(....))
my questions are:

1. do I need to call php function or javascript function onchange of select tag and if php how can i do that? 2.how can we take form variables (value of select) and put them in sql statement?

View Replies !
Combo Based
I need a solution to load data from db in combo based on the option selected in the previous combo for eg. have the list of countries(from db). should load the states(from db) based on the value we select in the country combo.

View Replies !
Combo Box Updating
I'm making a database input page for online gaming, and I'm having a little trouble. It's for a horse racing game, and I will be the only one doing the input. but I want to do the following: display only "player name" combo boxes. As the players are selected, I want to display the "horse name" and "driver name" combo boxes.

View Replies !
Database Value Select In Combo Box!
This function is intended to display the current database field value as selected.. along with other values as general options.

I can't figure out how to get it work. Help is appreciated!!

function retrieve_category()
{
$cat = mysql_query("SELECT category_id FROM category");
while ($current_row = mysql_fetch_row($cat))
{
$row = $current_row[0];
if ($row == $id)
{
printf("<option selected>%s</option>
",$current_row[0]);
}
else
{
printf("<option>%s</option>
",$current_row[0]);
}
}
}

View Replies !

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