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




Checkboxes Displayed In Table


I have a query with 40ish results I want to display in a 5 row table with checkboxes but am stumped as to how. PHP Code:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Table And Checkboxes
i have a table which basically just displays all the stuff out of a database and a check box at the end which i want 2 be able to if the checkbox is checked update and set broken_links = Ɔ' for that id, i can get it 2 change 1 but i want to be able to click like 10 checkboxes and it changes broken_links to 0 for them all Code:

Dynamic Checkboxes From Mysql Table
tearing my hair out over this!

I have 2 tables:

PTable which lists all traits
pid,ptype
1,good
2,bad
3,neutral

UserP Table which records user and traits
uid,pid
1,2
1,3
9,1
9,2
9,3

For a certain user UID, how can I get php to automatically create html
checkboxes listing ALL traits from PTable and check each trait based
on the UserP table on a webpage?

Hence, if UID is 1

it should show
good - unchecked
bad - checked
neutral - checked

Adding Multiple Rows To Table Using Checkboxes
I'm looking to select using checkboxes certain rows from the results of 'table a' and add the selected rows to another table using checkboxes. I Have had limited success adapting some code for deleting multiple records using checkboxes. Code:

Want Only 100 Words Displayed
I want to display data collected from mysql in a table-cell but I want no more than 100 words to be displayed, there will be a link to the full story in the cell.

Incorrect Id Value Being Displayed
Can anyone tell me why the $list_id variable is passing the last value in the DB and not the list_id associated with that row?

When $featured == 'true' the list_id displays correctly but when i try to submit it it displays the last $last_id in the DB. PHP Code:

Page Cannot Be Displayed
Im using php.exe on win2k. When I visit a php page i get page cannot be
displayed. Other pages work fine. Any ideas? the php dll wont work at all,
it refuses to read the ini file at all.

Really anonying, cant figure this out.

Everything After ' Character Is Not Displayed
I have been getting strange behaviour when using ' in by textboxes.

eg inputting the following
this is some test text ' and so is this

is saved to the mysql database ok as

this is some test text /' and so is this (with add slashes)
or
this is some test text ' and so is this (without add slashes)

mysql field is VARCHAR(255)

but when I retreive the data and display in textboxes on my web page, text
area type (below) is ok
<textarea class='BodyText' style='WIDTH: 85%' name="textarea"><?php echo
$opta; ?></textarea>

but input type (below) cuts everything off after the ' character. However
this does not happen with other characters such as " or /
<input type='text' class='BodyText' style='WIDTH: 85%' name='test'
value='<?php echo $opta; ?>'>

can anyone explain this behaviour and have a solution so that text with any
' characters in it is fully displayed?

No PHP Displayed In Browser?
I am new to setting up servers and am tring to set up a server to test my websites so I do not have to rent web space anymore.

I have Apache 2.0.55 running on my machine now. I used the windows install version because I do not know how to build it from the source. I have configured PHP 5.1.1 like the install files explained. the service starts without any errors that I can see.

My problem is when I try to test a simple PHP script I get nothing in my browser. The browser will display regular html though. If from a command prompt window I type php -i I get the list of settings I am suppost to see in my php script with phpinfo(); .

Can anyone tell me what I missed or something to try and help?

PhpMyAdmin - Page Cannot Be Displayed
I programmed my config.inc.php file with the codes below. But i cant go to the website.. It shows an error msg, "page cannot be displayed"

What haf i done wrong.. N i m actually not sure about my local host.. Cos i m using my school wireless network..

$cfg['PmaAbsoluteUri'] = 'http://www.example.com/phpMyAdmin-2.5.7-pl1/'

$i = 0;

$cfg['Servers'][$i]['host'] = 'example.com' // MySQL hostname

$cfg['Servers'][$i]['port'] = ''

$cfg['Servers'][$i]['socket'] = ''

$cfg['Servers'][$i]['connect_type'] = 'tcp'

$cfg['Servers'][$i]['controluser'] = ''

$cfg['Servers'][$i]['controlpass'] = ''

$cfg['Servers'][$i]['auth_type'] = 'config' // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user'] = 'username' // MySQL user
$cfg['Servers'][$i]['password'] = 'my_pass' // MySQL password (only needed
// with 'config' auth_type)

Decimal Spaces Displayed...
Could someone please tell me how you can limit the number of decimal spaces shown when displaying a variable... i.e.

<?php

$Pie = 22 / 7;
echo("<p> $Pie </p>");
?>

I want to be able to print 3.14, not 3.14154534576.

Linebreaks In My Mail Not Displayed
Linebreaks in my mail message won't be displayed. They are there when I view the source in Thunderbird but not Thunderbird nor Gmail displays them. What could cause it?

The Image Cannot Be Displayed, Because It Contains Errors
On running the following code :

<?
/* initialize a session. */
session_start();
/*header*/
Header("Content-Type: image/png");

/*We'll set this variable later.*/
$new_string;

/*register the session variable. */
session_register('new_string');
include ('mysql.php');
echo "<html>
<head>
<title> Forgot Username </title>
<link type="text/css" rel="stylesheet" href="css.css">
</head>
<body>
<form name="form1" action="" method="POST">
<fieldset>
<legend>Information</legend>
<label class="left">E-mail Address :<br>
<font size="-2"> This is the address you provided during registration </font></label>
<label class="right">
<input type="text" name="email">
</label>
<label class="left">Enter the code as you see in the box :<br>
<font size="-2"> Case Sensitive </font></label>
<label class="right">
<input type="text" name="image"> <img src="verify.png">
</label>
";
/* set up image, the first number is the width and the second is the height*/
$im = ImageCreate(200, 40);

/*creates two variables to store color*/
$white = ImageColorAllocate($im, 255, 255, 255);
$black = ImageColorAllocate($im, 0, 0, 0);

/*random string generator.*/
/*The seed for the random number*/
srand((double)microtime()*1000000);

/*Runs the string through the md5 function*/
$string = md5(rand(0,9999));

/*creates the new string. */
$new_string = substr($string, 17, 5);

/*fill image with black*/
ImageFill($im, 0, 0, $black);

/*writes string */
ImageString($im, 4, 96, 19, $new_string, $white);

/* output to browser*/
ImagePNG($im, "verify.png");
ImageDestroy($im);
?>

It outputs :

The image “http://vsenepal/account_settings.php” cannot be displayed, because it contains errors.

Number Of Rows--displayed
Is there a way to call a function that would display the number of rows in a table?
I'd like to have a count on the page that allows people to query the database to demonstrate that the database is growing and constantly changing.

Limit Results Displayed
I have tried a few different tutorials etc on this but I cant get it to work properly with my code. What i need is the page to display 10 results per page and to automatically create a "Prev | 1 | 2 | 3 ..etc | Next" navigation that runs the results of the query.
PHP Code:

Formatting Displayed Txt CSS And Wordwrap
I am using the follwing to display the contents of try.txt. It displays fine but I cannot alter the font via CSS, any ideas? Also I need the displayed txt to wordwrap within its DIV but i cannot figure it out!

<?php  $lines = file("try.txt");

 echo '';

 foreach($lines as $line)
  echo str_replace("<", "&lt;", $line)."";

 echo ''; ?>

Calling For Data To Be Displayed Using The URL
I'm having a problem getting my code to pull the appropriate information when I call for it via URL. (example: http://..../.php?id=2). For some reason I can't get it to pull the information for ID #2 (or any ID over 1) and input that information into my dynamic page. No matter what ID i type, or even if I neglect to type in an ID to begin with, it displays the same information.

What am I doing wrong? The entire code for my page is pasted below. If anyone could help I would be grateful. I know there's something simple i'm over looking, but I can't figure out what. 

It connects and downloads the information for ID #1 if I remove $_GET and replace it w/ $row_StaffDirectory, but this is where it only pulls information for ID #1 and no other, no matter which ID I call it from in the URL. Any ideas? Code:

Image Cannot Be Displayed, Because It Contains Error ...
the script that show image is:

<?php
include('dbinfo.inc.php');

mysql_connect($localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT file,filesize,filetype FROM user WHERE id=1;";
$result=mysql_query($query);
mysql_close();

$file=mysql_result($result,0,"file");
$filesize=mysql_result($result,0,"filesize");
$filetype=mysql_result($result,0,"filetype");

header('Content-Type: '.$filetype);
header("Content-Disposition: attachement
");
print $file;
?>

it's work fine execpt it show the image as a attachement (Save as... window), so Apache, mysql, php seem to work fine. the problem is only on http header of image i think.
i want the image directly so, i use this:

<?php
include('dbinfo.inc.php');

mysql_connect($localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT file,filesize,filetype FROM user WHERE id=1;";
$result=mysql_query($query);
mysql_close();

$file=mysql_result($result,0,"file");
$filesize=mysql_result($result,0,"filesize");
$filetype=mysql_result($result,0,"filetype");

header('Content-Type: '.$filetype);
print $file;
?>

it's don't work, firefox gave me "The image http://ip:8080/viewimage.php cannot be displayed, because it contains error." IE show me nothing at all.

any one have a idea ?

----------------------------------------------------
Windows NT 5.1 build 2600 (XP Professional English)
Apache 2.0.54, running as a server
PHP Version 5.0.4 running as module
MySQL 4.1.7 (a dll from php)
Firefox english 1.0.4
Internet Explorer 6

Image Created With Gd Are Downloaded Non Displayed!!!
I use a gd function for create png image for show graphs, but some user told that is unable to see the graph but the PC ask for download the image.

Limit Amount Displayed In Array
I need to limit the amount displayed in an array. if the array is 100 I need to limit it to the first ten. I tried to do range but I can't seem to get it to work. here is how I am showing the array.

<?
$results = array_unique($results);
foreach($results as $resultsindex =>$goto)
{
?>
<a href="index.php?mode=2&url=<? echo $url.$goto;?>"><? echo $goto;?></a><br>
<?
}

Limit # Chars Displayed On Echo?
I have a database w/ several text fields. I want to be able to echo only the first, say, 100 characters of the field only, instead of the whole thing. Is this possible?

Load Time Displayed Question
I was looking at a couple of pages yesterday that were coded in PHP, and at the bottom was a "Page loaded in ______" blurb at the bottom. Good example is at www.digitaljedi.com. How could I go about creating a script that would initialize that function. Could it be as simple as doing something like this PHP Code:

Different Graphic Displayed Depending On Host
I know that you can display the host name in PHP using <? echo $HTTP_HOST; ?>, but how can you display a different text and a different image depending on the host the page is called from?

PHP Nuke 8: Security Code Not Being Displayed
I've got PHP Nuke 8 installed and running but I've run into one problem. First of all, everything installed fine without any errors. After Nuke was installed I added the following modules: Shout Box, Leaderboards, Gallery, and Sentinel. Prior to installing ANY modules with just PHP Nuke installed the Security Code was readily viewable on the login page (both for users login and admin login pages). Without remembering exactly when the security code image disappeared, all I can say is it's not viewable now.

Hiding Hyperlinks For Page Displayed
Can anyone point me in a direction to find a tutorial on writing a script that will hide, (not show) The text link for the home page if my vistor is on the home page. i have read a book and they have on th4ere but it only deals with changing the type of image not disabling it and hiding it from veiw.

Randomizing Amounts Of Html Displayed
I have a HTML table with 5 rows of data. I would like to randomly display 3 of the 5 rows when the page is accessed. PHP Code:

How To Limit The Number Of Picture Displayed
I have a fully working photo gallery. A database stores the image locations and then returns the location within the <img src=> tag. What i need to do is limit the number of picture displayed on one page.

Lets say if more than 50 pictures are displayed then a next button is generated. Once clicked the page refreshes displaying the next lot of pictures.

As i am a low leveled PHP guy im not sure how to go about this. Any ideas?

Reduce Displayed Text Length
I am currently displaying people's names on the screen, but some people's names are longer than others. How do I display only 6 characters of a person's name, then display three dots (...) at the end.

$result = mysql_query("SELECT * FROM person");

while($row = mysql_fetch_array($result))
{
  echo $row['name'];
}

Sign '+' Is Not Being Displayed From A Mysql Database
Why  this sign '+' is not being displayed when i fetch it from a mysql database  ?

Special Character Is Not Displayed Both PHP And In Javascript
I have some problem while displaying the content with special characters like other language especially from Belgium Dutch characters, I meant the exact database table content [Belgium Dutch characters] not displayed in respective pages but only shows the other symbol like? [Question mark], please help me to avoid this problem.

Returned Values Displayed Differently?
I've got a function in PHP that calls values from a MYSQL DB, and it returns numbers. (eg. - Woolyg - 14)

Is there a way in PHP to substitute these numbers for worded values? So say if the function returned values 1-10 it displays the word 'Useless'... 10-20 displays 'Average'... and 20-30 displays 'Awesome'..?

Problems With Paging. Limit The Numbers Displayed
I'm having a problem with paging. I can do the paging but I want to limit the numbering. So if I had pages 1 to 30 I want 1 to 10 displayed and a next button beside the 10.

Here's what I got.

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

How To Limit Number Of Lines Displayed On The Page?
I just wrote this script to read information from a TXT file that contains list of JPEG files, and the list is rather huge. So I want to limit the number of displayed files to like 20 per page (with NEXT/PREVIOUS links to the next or previous 20), but I have no clue how to do it. Code:

PHP & Frames; Why Is The Full PHP Code Displayed In Frame?
Having completed a whole stack of PHP files, tested them (worked fine), I now have to let these pages be displayed in my client's website.
But said client has done his website in frames.

When I put in code like:

<frame name="main" src="myphpfile.php" >

what get's displayed in that frame is the full php code

Example: echo $name
instead of the actual name

so the browser is not sending the code to PHP first, it seems. How do I fix this?

I presume it's not a matter of, you can't have frames in a PHP/MySQL site.

Random Order Help Request - Prevent Previously Displayed Objects
I have a query that is showing new items in a store based upon their
inventory date. The problem with my Random order sort is that when the
"next" link is pressed, the random function is called again and I may see
the image previously displayed rather than go through the entire new
inventory.

SELECT *
FROM `Catalog`
WHERE (`Catalog`.thumbnail LIKE '%-04.%' or `Catalog`.thumbnail LIKE
'%-05.%' or`Catalog`.thumbnail LIKE '%-03.%' ) and `Catalog`.img_status =
&#391;' and `Catalog`.views != &#390;' ORDER BY RAND()

Checkboxes
I've got a form with multiple checkboxes (1-1000 depending what you get from database), and all of those checkboxes are named with an unique id: $Id. What I wanna do is when the form is submitted, all of the rows where checkbox is selected will be updated.

I know that it's done by UPDATE TABLE SET Field = 'New Value' WHERE Id IN (1,2,4,8...)

But how can I read what checkboxes are checked, when the name of the checkboxes are changing?

Checkboxes
I have a form with 3 checkboxes wich have all the same name:

<input type=checkbox name=test value=val1>
<input type=checkbox name=test value=val2>
<input type=checkbox name=test value=val3>

now on the target page i need all values that are checked, so if they are all 3 ckecked i need to get val1, val2 and val3 on the target page. With ASP you get the varaible test = val1;val2;val3 (the values are all put in one variable, separated with a ";"

But when i use PhP i only get the last value in this case "val3". What do i need to do to get all values? I have named them all the same because those checkboxes are dynamicly generated. I dont know how many there will be.

Checkboxes
I have a two checkboxes in HTML:

<input TYPE="checkbox" NAME="cc" VALUE="true"></td><td><b>Credit
Card</b></td></tr>

<input TYPE="checkbox" NAME="cash" VALUE="true"></td><td><b>Company
Check</b>

<input type=button onClick='<?php reviewpayment()?>' value='Continue'
style='font: 10pt Arial;

The function works if I type into the function
$cc = true;
$cash = false;

<?php
function reviewpayment() {
$validity = TRUE;
if ($cc && cash) {
echo 'javascript:alert(" Please select ONLY ONE type of payment ");'
$validity = FALSE; }
.................... ?.

Therefore the function is not receiving the input from the check boxes.

How do I structure the script and HTML to send the input cc and cash in HTML
to $cc and $cash in PHP?

PHP Checkboxes
How do I send CHECKBOXES via email through the mail() function in PHP?

Example: You have 67 checkboxes, all with unique names, but only want
to send the ones that were checked.

Mailer: Verifies only 2 of those 67 were checked, so the email only
has 2 checkboxes checked.

Checkboxes
I have it so a user ticks checkboxes with what 6 numbers they chose, and i need it to check it with a list of 12 numbers and when they press submit, if they got any correct, its says how many they got right.

I laso need it to say if someone has selected more than six options. The checkboxes id are the numbers, ie checkbox1, checkbox2, checkbox3 etc up to checkbox20 Code:

Allow Only 3 Checkboxes ?
How can I limit number of maximum selected checkboxes to only 3 if I have total of 10 checkboxes? I need to limit to 3 answers in poll that have 10 answers. I use the following to print checkboxes: PHP Code:

Checkboxes
I'm trying to construct a checkbox array in a survey form where one
of the choices is "No Preference" which is checked by default.

If the victim chooses other than "No Preference", I'd like to uncheck
the "No Preferences" box and submit the other choices to the rest of the
form as an array.

I have most of it worked out, but I'm stuck on an apparent disconnect
between php and javascript.

When I use this code:

Checkboxes ...
I was wondering how to run a query for every check box checked, Ive looked around the net and nothing I've come accross is too usefull.

PHP And Checkboxes
<input type="checkbox" name="approved" id="approved" <?php if($f['enabled'] == "1") echo "checked="checked""; ?>" />

it saves it as a boolean in the Db.. how do I set the bool in the DB?

Checkboxes
I have been trying to learn checkboxes and arrays, and I've finally figured out how to add the checkboxes to the database.

I currently have two forms  addlinks.php and modifylinks.php and I have a dolinks.php that submits my data to the database.

What I would like to do now is on my modifylinks page show a tick in the boxes to show that they have already been added.

At the moment if I dont tick any boxes on modifylinks.php it deletes my previous data, and I have to retick them everytime I do an update. Code:

Checkboxes
I have a contact form that has about 15 checkboxes on it for different interest. I am curious on the best practice for setting up my mysql table to store the info from the form and how to check which one is selected /checked

Checkboxes From A Mysql DB
I'm creating a page that includes check boxes that are dynamically pulled from a MySQL database. I have gotten it to correctly pull up the boxes and name them, but when I make a change and submit, all of the values that were checked are set to 0 instead of 1.

This should print out a checkbox, checked if it is supposed to be, and take an argument to be passed when the user chooses to update the page.

When I submit my form, all of the checkboxes pass a value of zero even when they are checked.
Can you tell me if there is an error in this statement?

print "<td valign='top'>";
print "<input type=checkbox name=checkbox_$cat_name value='checked' $checked[$j]></td>";
print ${"checkbox_".$field_name}." !!!";
print "<td valign='top'>$list_cat_name</td>";

$checked[$j] - contains the value 'checked' or nothing set (correctly) earlier in the file
the checkboxes are named checkbox_(fieldname) [ex: checkbox_food]

The value 'checked' is passed to another file that updates the db.

Cycle Through Checkboxes
I am fairly new to PHP and ran into a problem that I am sure someone can help me out with. I have a list of email addresses that I am pulling from mySQL, and printing them in table rows with checkboxes in front of each row so that the user can select the address to be deleted from the DB when the user clicks submit button.

I am naming each checkbox "c_<email address>". The output works fine.

The problem that I am having is, how do I make PHP cycle through each of the checkboxes to check to see which one or ones are checked?

Checkboxes, Arrays And SQL
I am very new with PHP, so I hope someone can help me: With the help of JPJones, I've managed to write a basic search script querying a MySQL database.

I would like my users to choose which fields they search from, eg search for "red" in field1, field2 and field7 only.

I would use checkboxes for this, using [], eg:
<input type="checkbox" id="field[]" value="field1">Field 1

I understand I would have to split the $field array (on the comma delimiter?) and then use it in my SQL statement. Would it be something like this?

foreach($fieldarray as $key=>$value)
{
$sql = "SELECT * FROM table WHERE $fieldarray[i] LIKE '%$searchword%'";
}

I have no idea of the correct syntax.


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