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




Echoing Value To List Menu


Hi, I was wondering can I echo out value from db to list menu and how?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
List Menu Choices?
Why does Multiple Choice List only report 1 value? i got a normal form: Code:

Can You Read A Value Into A List Menu?
a system i am developing has both a user and an admin side. The user can add a record and then the status of this is initially set to a fixed value.

What I am wondering is, if i stick with a list of say 4 possible status', how can i get whatever status the admin changes the record to to be "sticky" on the menu the next time he looks at the call, as opposed to the menu showing the default value set in dreamweaver?

Select List/Menu Using PHP And MYSQL
Here is my code:

<select name="country" class="sidelinks">
<?php
do
{
?>
<option value="<?php echo $row_AllCountries['country_ID']." ";?>"<?php if ($row_AllCountries['country_ID'] = $acountry) { echo "selected"; }?> >
<?php echo $row_AllCountries['countryname'];?></option>
<?php
}
while ($row_AllCountries = mysql_fetch_assoc($AllCountries));
?>
</select>

A few words to describe:
-$row_AllCountries['country_ID'](get from MySQL) is a unique country ID number
-$row_AllCountries['countryname'](get from MySQL) is the name of the country
-$acountry is the country ID number that i want to be selected when the form loads

I have all the values and country names named OK...the only problem is that when the form loads it selects the last country.

Adding Items To A List Or Menu
Not sure if it is a php question but since i am working in php here it is.

Ho can i add items to (the item label=visual text and the value=index
number) a list object on a website.

I am having a list with 4 items and i would like to add the text from a
textfield (textfield1.value) to the list object so it will hold 5 items.

PHP / Javascript Menu List Population
I would like a web page to have 2 menu lists

The contents of the second menu list depending on the selection made in
the first.

The contents of the second would be populated from a database.

I am fairly new to programming using PHP, Javascript and MySQL but I am
sure what I am asking has been done before. Could someone please give
me some pointers or direct me to a tutorial.

Change List View To Dropdown Menu
Im working on a script that has to be change so a user can choose from a dropdown menu instead of a list that now is displayed.
Here is the part that is insert on the index page.

Creating Simple Unordered List Menu From XML?
Does anyone have any examples or links to examples of generating a
simple unordered list menu with multiple levels from an XML file? We
are redesigning the navigation on our website and I was hoping to make
this as flexible as possible.


Long Strings In List/menu Boxes
Is there a way to get a list/menu box to resize as the page is resized and
for any long string that is an item in the list to be spread over two or
more lines in the same way as text in a table does.

Flat File List Style Menu
I'm trying to build a Menu Building out of flatfiling with a section to add new areas to it.  The idea behind it is to have a header for each section (as the top order list item) then each one below is a link of that category.

I already figured I'm buillding it with limits (20 items Max per heading) and that to do it I will simply have each Heading/links in it be a new row in the document.  example row Tips tips.php Tips on Php, file tips File Tips tips/files.php, etc etc

With the first item of each row being the Heading and each other being the ones under it My question is What delimiters should I use to seperate in the row (I need to separate each item by 1 delimiter and then in each row separate the href, alt, name)

Secondly for rewrtiign it should I simply write it so each time it rewrites the whole file or should  I try and do string replacing and do modify sorta deal.

Print Array In List/menu Form Object
how i print a full column array into a list/menu form object, so that the text links to their respective page.....it is basically for a list of interviews so you click on the band name and then goto the interview page.

[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.

Echoing Sql
Another good thing to do would be to set the sql statement equal to a variable instead of just inside of the mysql_query() function. PHP Code:

Echoing Image
form action="index.php#order" method="post" name="image1" id="image1">
<input name="image1" type="submit" id="image1" value="Buy!">

form action="index.php#order" method="post" name="image2" id="image2">
<input name="image2" type="submit" id="image3" value="Buy!">

<form name="form1" method="post" action="thankyou.php">

<?php
if ($_POST[image1]) {
echo "<img src="image/image1.jpg">";
}
if ($_POST[image2]) {
echo "<img src="image/image2.jpg">";
}
?>

Problem Echoing
If I set a varaible as

$EOL = "
"

But then want to echo that to a HTML page to see the above string
i.e.

by doing: echo($EOL);

How do I do it?

I've tried quotemeta, addslashes and htmlspecialchar
but can't seem to work it out.

Echoing An '&' Character?
I'm trying to figure out how to include an '&' character in a php echo. I'm not looking for the html & a m p ; special character, but the actual character, since i'm trying to do this: Code:

echo "<A HREF"/download.php?type=wallpaper&file=$filename">Download</A>";

instead it returns a link such as this: Code:

/download.php?type=wallpaperfile=wallpaper.zip

Echoing Php In A Textfield
when i echo out text from mysql in a text area field it also echoes out the line breaks e.g it doesn't happen if i echo out anywhere else on the page, could i do a preg_replace to make all the line breaks echo NULL? Code:

Echoing Codes
I have a simple script for an IFrame for my forum page...

<?php if(!isset($_GET['post'])){ echo '<iframe src="/forum/" name="fleet" width="800" height="auto" scrolling="no" frameborder="no" id="fleet"> Your browser does not support inline frames or is currently configured not to display inline frames. </iframe>'; }else{
 echo '<iframe src="/forum/viewtopic.php?p='.$_GET['post'].'" name="fleet" width="800" height="auto" scrolling="no" frameborder="no" id="fleet"> Your browser does not support inline frames or is currently configured not to display inline frames. </iframe>';} ?>

Whenever I open the page, it does not automatically expand to the framed page height, how can I fix this...?

Echoing Out A While In A Table
i use this while loop to echout all my categories at once, but is there a way i could have them echo out in a table say 5 across at a time? Code:

Echoing Strings With Quotemarks?
I have a statement that gives me an error:

echo "<table><tr><td>Title</td><td>Author</td><td>Date added</td><td>Hits</td></tr><tr><td><a href="test">$arttitle</a></td><td>$artauthor (<a href=/"mailto:$artauthoremail/">)</td><td>$artcreationdate</td><td>$arthits</td></tr></table><br>";


Parse error: parse error, unexpected T_STRING, expecting ',' or '' in /home/hsphere/local/home/cmwong/singaporeanimenews.net/mm-article.php on line 299


backslashing the quotemarks continues giving the error. How might I get around this?

Echoing Variables Into HTML
So I'm playing with a very retarded list of products 1-9, and have the
following list.php page snippet excluding html header/footers/table tags:

Echoing PHP Code From A Database?
I have the following data in a MySQL database:
<a href="<?php echo $server; ?>Sugapablo-Stick_It_To_The_Man.mp3"

let's call it $row[0].

when I echo $row[0], the php code is shown as opposed to the value of
$server.

How can I get the value of $server to appear? str_replace?

Php/mysql Echoing Same Thing Twice--help!
I'm just learning php and set up a sample mysql db to practice with. I
have the following script and cannot for the life of me figure out why
it is printing each field of the row twice? I checked my db and it only
contains the entries once. What is causing this?!

-----------------------------------------------------------------------
<?php
$con_id = mysql_connect('localhost','dboard_mbr','pa1ss2wo3r d');

mysql_select_db('kp_dboard',$con_id);

echo join(mysql_fetch_array($thequery=mysql_query('sele ct * from
threads',$con_id)),' --- ') . '<br>'

echo join(mysql_fetch_array($thequery),' --- ') . '<br>'

echo join(mysql_fetch_array($thequery),' --- ');
?>
-----------------------------------------------------------------------

Strange Results Echoing '£'
I'm getting a very strange result trying to echo a simple pound sign '£'. Here's my code:

$currency = '£';
echo $currency;
For some reason it's outputting this:
£With the Â...

I've tried this as well: echo htmlentities($currency)but I get the same result.. I've never had this problem before and it doesn't6 happen with any other symbols, could anyone suggest an answer?

Echoing The Correct XML Tag Data
I am having trouble ECHOing specific data and for some reason the links for each sub parent are combined into one link...Let me explain that. The first link is correct and outputs http://example.com/1, but the second link outputs http://example.com/1http://example.com/2

Does anyone know why that is? The other problem I have is that I have about 200 sub parents in my xml file and the sub parents represent different categories, for example: Code:

Join And Echoing Correct Id
The information is displayed correctly.  The problem comes into play with the record id's. 

The link I would click on for the employees name is echoing the job id and not the employee id so I get sent to the job page and not the employee profile.  The link I would click on for the job is echoing fine. Code:

Echoing Multiple Arrays
I have a products table that I want to echo the results of 3 different categories, I can query the db just fine and get results for a single category, but I'm a newb to PHP and don't know the trick way to do slick recursion. Code:

Gathering Results And Echoing Them As One?
I'm trying to display all the results from a database and use echo them using $total.

$total =     do {  "".$row_use['lon']." ".$row_use['lat'].""  } while ($row_use = mysql_fetch_assoc($use));

echo $total;

I was wondering why does that not work?  How do I get the php repeated regions to work?

Echoing A Variable Which Isn't Set Until Later In The File?
I could have sworn this was possible somehow, but it isn't working for me... Let's say I have a line at the top of my file, which is echo "$links". Then, the variable $links is set further down in the file, depending on some SQL results and GET variables.

For me, even though I'm setting $links in the file, it will only echo if it's set before it's echoed. It make sense, but I have a definete memory that I once had a way around that problem - anyone know how to do it? Code:

Setting Headers And Echoing Images
My scenario is that I am trying to put an image on a page using php not on my server, that does not have php. I am using the tag <img src=http://myserver.com/asdf.php3> and asdf will a) read an image b) set a header("Content-type: image/gif") and c) echo the image. That works fine.
The problem is that I also wanted to include a link based on the image (ie - dynamic, involving php). After I set the header, regular tags are ignored and I can't echo anything before a header, nor can I set a different header.
SO my question is, does anyone know a workaround to this problem: like displaying an image on a non-server page, without setting a header, or a way to dynamical reference something? Any help is greatly appreciated and if you think you might be able to help, but don't understand my situation or need clarification, contact me.

PS - If it can't be done with PHP, can it be done with any other language anyone knows of?

Time - Echoing It Back Differently
I have a datetime column setup in a mysql database. My web host, which i based in Hawaii, has a different time zone to that of mine over her in good old England. I was wondering is there a way of echoing out the time from the datetime column but adding on 9 hours more?? Or even would it be easier to submit the data into the database with the time difference?

Echoing 3 Types Of Data From 1 Table Row
I have this script where one of the rows in a mysql table is named "type" tinyint(3).

now when a person joins the site they have a basic membership and their data is 0 in the type row when they become silver members it is 1 and gold is 2 all 3 numbers are entered into that one row for each member depending on what kind of membership they have.

what I want to do is echo each type of membership on a page by the total number of each type so say there is 100 basic memberships then it would add up all the 0's within the row in the mysql database and then echo that total. I have already gotten it to display total number of users by adding. Code:

$query = "select id from user";
$result = MYSQL_QUERY($query);
$totalusers=mysql_num_rows($result);
@mysql_free_result($result);
if(($s=="")or($s>=$totalusers)or($s<0)){
$s=0;}

and then having <?print $totalusers;?> where ever I want it to echo. How can I do the same with the memberships? I have a feeling that it would have something to do with $totalusers=mysql_num_rows($result); i need to change mysql_num_rows to something else?

Selective Echoing And Database Select
I have written a search engine for business listings for the company I work for. Each listing is in a database, and that works fine. The problem though is two-fold.

The first part of the problem is that not all listings utilise every column of the database, and this leaves gaps when echoing the results. This is not what i had in mind, Any ideas/help would be appreciated.

The second part of the problem is related to the first in that there is a link for any listing that has a website, but not every listing has a website, so every listing having a "Visit our Site" link is impractical and shoddy. Also, i'm not sure how to echo the url from the database effectively in the first place.

Echoing Multiple Html Tables
im trying to echo out multiple results from a database and returning them in a table. Each new row in the database leads should lead to a new row in the HTML table. However I can only get it so the first row from the database goes into the html table as it should, the rest go outside it. Any ideas? Code:

Echoing Users Data From Mysql
when users on my site look at they're profile details some of the data in like this:

<select name="somename">
<option value="Option 1">Option 1</option>
<option value="Option 2">Option 2</option>
</select>

once a user has selected an option and it's stored in mysql i was wanting the specific information to be displayed in the drop down box, if i selected option 2 next time i log in option 2 is displayed and so on. what would be the best way to achieve this?

Is_dir() And Opendir() - Detecting Sub_directories And Echoing Them?
I am working on a single script to:

1) create a menu of directories containing photos (jump to script below)
2) output all the thumbnails of each photo (linked to photo itself) within each linked directory

I have step 2 solved. However, as I was about to solve step 1, I mucked up my code so badly I lost it. I simply want to output all the sub_directory names within a directory.

my structure is as follows:

../images/photos/group
../images/photos/sports
../images/photos/outdoors
etc.

The script itself is currently located in the images directory but could also be located in the photos directory as I want to detect all sub_directories of photos. Here is the part of the script that is supposed to do what I want in step 1. PHP Code:

Not Echoing A Variable If It Exists In A MySQL Table
I have a variable $mydate which loops for all the days of a month (in a while loop), so therefore for April its:

01042007
02042007
03042007, etc...

I also have a MySQL table "bookings", which contains the field "date". This field is populated with rows of dates, with the same format as those in $mydate (eg. 01042007)
Is there any way to not echo $mydate if it exists as one of the entries in the "date" field in the database?

List Contents Of A Folder, Make List Of Links
Does anyone know how I can write a script that:

- reads in all the files in a particular directory
- displays the file names in a html list and makes a link of them:
<ul>
<li><a href="filelocation1">filename 1</li>
<li><a href="filelocation2">filename 1</li>
<li><a href="filelocation3">filename 1</li>
</ul>

etc.?

So basically it creates a list of links with the contents in that directory,
so you can download them from there.

Get List Of Messages From One Table, Message List Indicator From
I have two tables. One has a list of messages left by users using fields named mbxno for the mailbox and msgno for the message number. I have another table that has mailbox settings for each user that contains a field named "messagelist" to indicate if they want to be included on the message list or not.

What I'm trying to create is a list of the most-recent messages with a lookup on the users table to indicate whether a message in the list should be included in the message list based on the user's mailbox settings.

SELECT messages.msgno, messages.mbxno, users.messagelist FROM messages, users WHERE (users.messagelist = &#391;') ORDER BY msgno DESC LIMIT 100

What I'm getting, though is a list that looks like this:

mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1

I think what's happening is that I'm using the wrong type of join and more rows are being created than necessary.

If I add "DISTINCT" to the query, I get a list of the most-recent messages as I expect, but the "messsagelist" value is sometimes wrong (again, probably because the data is getting jumbled). For example, the messagelist value for the second row (2214) should be 0, not 1.

mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 2214 msgno: 0412141622 msglist: 1
mbxno: 2189 msgno: 0412141408 msglist: 1
mbxno: 0000 msgno: 0412141213 msglist: 1
mbxno: 0003 msgno: 0412141213 msglist: 1
mbxno: 2265 msgno: 0412132029 msglist: 1
mbxno: 0000 msgno: 0412131950 msglist: 1

How should I be doing this? If nothing else, what kind of join will work with a long list compared to a value from a short list?

Populating A List Box Or A Dropdown List Using Php And Odbc
I need to populate a list box and/or a dropdown list on a form. I have all
the bits and pieces together, all bar the code which takes the result of a
query and creates a list box.

Mailing List Manager, Send To List
I'm looking for a mailing list script (php) that has a function to let
users to reach out to all recipient on the list by simple send the
email to a specific maillist- address.

Mailman has this functionn but as a just got a webserver account I
can't use mailman nor install it.

Getting Another Menu
how can I do to create another menu with the results from the options they choose?
For example, they are looking for their grades so they choose in a first menu the carreer, in other menu the grade, and then when they finish choosing the grade, It appear automaticaly in other menu all the names of the subjects concerned to te carreer and grade given.

Php Menu
How do I have The menu and the context information display at the same time? Code:

Populate One Menu From Another
I thought this would be simple and there would be advice / tutorials
everywhere for this, but now that I'm working on it, I can't find any
reference except for ASP or Javascript code. PHP/MySQL - 3 form select
menus: Project, Categories, Subcategories. When a Project is selected, the
Categories list is populated based on Project selected, then Subcategories
list is populated based on Category selected. I see this all over the Net,
but through 10 books, there isn't anything specific. I think I get lost
with some of PHP structure since I've been using DW - I end up editing most
of it in order to follow it, but DW works pretty good for getting initial
testing done. I just can't seem to find further guidance on this. So far I
have:

Drop Down Menu(add Cat)
I have DB to add category and forum to edit the terms that in the cat so I add this code in the edit forum to change the cat of the term by choose the cat from drop down menu
PHP Code:

Collapsing Menu
I have written the code to do this however I am completely at a loss to do one particular thing. To best explain what the problem is I will give you an overview of how the menu hangs together.

The menu looks like this:

Menu-submenu
I've to create a simple site with menu-submenu.

The submenu are shown in a "dropdown" object that use "<ul><li>"....

Here is the structure:

group1
menu1
menu2
group2
menu1
menu2
menu3
.....

by selecting the link group1, group1->menu1, group1->menu2 I'd like on a
left pane the submenus structure of the group1, but not the substructure of
the menu2 etc.

What's the simple way to create it ? I'd like to modify only once and have
this working on all my site (I use a simple template using a table).

Dropdown Menu
I want to upload a feild values into a dropdownmenu. can anyone help me how to write in php code.

Drop Down Menu
I have a page that uses php to look up specific fields in a specific table of a specific database based on the username. Using this, it creates a dropdown list of information belonging to that user. The fields in question each have 13 pieces of data. Based on what they click in the dropdown box, I need that specific data to pass onto hidden fields on the page. Code:

Drop Down Menu
I'm struggling to get this to work. It is suppose to show only $name and not $name and $email PHP Code:


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