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




Forms Generated From Mysql Data


I can't figure out how to get PHP to tell me which boxes were checked and how I can use this information. PHP Code:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Generated PHP Web Database Forms
I'm still gaining experiance in developing PHP applications, and have completed
a couple of projects already.

This has prompted me to look for ways to reduce the development time for web
enabled database applications. Every web database has basic operations such as
add,delete,update and search. I have been creating HTML forms and processing
the results with php code. I have managed to reduce the number of forms required
by using the smarty template engine.

I want to go a stage further and be able to produce the forms and the processing
code purely by looking at some sort of schema file , or using
"mysql_list_fields()" and "mysql_list_dbs()".

Before I start my quest of many late nights of coding. Can any of you guys
give me a head start by pointing me at a solution/hint.



Help In Creating Data Entry Forms With MySQL
I was wondering if any of you experts has some example of MySQL data
entry form either using PHP or any public domain software for my photo
album. I'd like to enter some description with it.

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

Passing Data Into Generated Pages
I have a template page with items being displayed on it and the idea is when a user clicks that item it's item id gets passed into the next page so that it can be compared against the flat file database and then when matched displayed the item information.

I'll show you how i am displaying items on a page and then i'll show you the code i have developed so far to try and get the item id to pass pages and display the item details. Code:

Getting MySQL Generated Keys
I am a Java/JSP developer by trade but am currently developing a
MySQL/PHP solution.

In JSP when I run an INSERT statement on the db I am able to
automatically get back a list of any generated keys (without having to
do some sort of subsequent query to get the information).

Is there a PHP equivilent of this?

Inserting Link Into A Table Generated From MySQL
I'm trying to insert a link into a table that is generated through a MySQL Query. Here's the code:

Php Generated Form Array And Formatting For Mysql Query
As part of a form I have created I have a MySQL generated table who's fields include soccer team names, opponents, next match date, matchid etc. . Each row has a check box with the value of the checkbox being the unique row ID in the MySQL table (match id). When a user selects the teams from the list he would like more information about, the checkbox variable is parsed to the script as an array "$var[]".

If I use the following code, I can see all the contents of the $Var array that has been parsed to the script.

[php
<?
$number=count($var);
for($a=0;$a<=$number;$a++){
echo $var[$a];
}
?> /php]

The problem is how do I format the above output so that I can include it in a MySQL query statement? I have no way of knowing how many teams have been selected or the key index number for each variable in the array. How do I code this so that each row matchid is assigned it's own unique varable such as team 1, team2 etc?

I was thinking of using a loop to go through the array and generate $var appended with a number using the the PHP count() function. but seeing that I am fairly new to PHP I'm not sure if this will work or where to start!

PHP Data Transfer In Forms
basically I am looking for a way to transfer form data into php variables. Most of them are not a problem but I can not figure out how to transfer select values or radio button values. Can anyone help? I will be posting the code for the page I am working on after I get home from work.

Submitting Data To HTML Forms?
Could someone please suggest the basic steps I need to take to automatically
submit a set of data to an online form using PHP? These are basic HTML forms
with text fields and option lists, and the form method is Post. I would like
to automate the submission process. Do I need to set up a dummy form on a...

Forms Data Format (FDF Functions)
Anyone used FDF functions in PHP like to share ideas how to populate, say a HCFA1500.PDF file from a MySQL database? Where do I start :-O ? Do I need to install the PDFlib at all? Or is it included in the PHP libraries already?

Make Forms Keep Data After Being Posted
I'm trying to set up a simple preview-type thing for my very first blog script (im new to php and mysql). First off, heres my code for the update (place to post a new article) page (excluding the includes to connect to the database): Code:

Forms: Keeping Form Data After Error
WHen using forms, what's the best way to check a database(mysql) for duplicates and return the same form and data if a duplicate is found. Basically, if a user submits a form and an error occurs, let them correct the data instead of entering all data over again.

Varifying Forms Text Data Help Needed
I bought the PHP and MySQL For Dummies book and I'm having trouble
understanding how I use PHP to verify and check forms input text data
- the book shows snippets of code so I know how to do the actual check
but I don't understand what web page the php checking code should go
into?

For example, I have a simple login web page (username and password)
and then it calls my mainmenu php web page - I want to make a check
that a username was actually typed in *before* calling the mainmenu
php page - I also know that I can do this check using javascript but
I'd like to stay in php if I can - how can I make the check and stay
on this login form before calling the mainmenu page?

Save Html-forms Data To Local Disk?
A question on html-forms:

We have an application where users will get a CD with,
among other things, some html-forms for them to fill in.
When they click the submit-button, the data is transferred
to a webserver php-script that will then process the info.
The forms-definition looks something like this:

<form action="http://www.ourdomain.com/receiver.php" method="post">
<p>Question 1:
<p><textarea name="reply01" cols="40" rows="5"></textarea>
<p>Question 2:
<p><textarea name="reply02" cols="40" rows="5"></textarea>
<p>Question 3:
<p><textarea name="reply03" cols="40" rows="5"></textarea>
... etc ...
<p><input type="submit" value="Submit answers!">
</form>

Now, my concern is (since there might be quite a lot of data filled in),
if e.g. the internet-connection for some reason is broken
at the moment when the user clicks the submit-button,
there is a risk they will lose all the text and would have to re-type it,
which I would like to avoid, of course.

How can I best solve this issue?

Ideally, I would like to store the info on their local C: drive
before submitting, and automatically retrieve the text if they
later return to the page, but I guess that's not possible from
an html doc, right?

If so, any other suggestions how to resolve this issue?

Forms And MySQL
I'd like to make a form that submits the data to a database. It's to make a database of members of a community, where everyone has his "member file".

Forms To MySQL
how to get input from an html form and insert them into a MySQL database, something like a simply buy/sell ads.

Checkbox Forms, Php & Mysql
I'm about to add some checkboxes to a form, and then store the data in
a column on a MySQL database. Just wanted to know best practice, at the
moment I'm writing and thinking .. God that's ungly code ...

<input type="checkbox" name="delta" <?php if ($delta==1) { echo
"checked"; }?>> Delta<br>
<input type="checkbox" name="mastercard" <?php if ($mastercard==1) {
echo "checked"; }?>> Mastercard<br>
<input type="checkbox" name="solo" <?php if ($solo==1) { echo
"checked"; }?>> Solo<br>
<input type="checkbox" name="switch" <?php if ($switch==1) { echo
"checked"; }?>> Switch<br>
<input type="checkbox" name="visa" <?php if ($visa==1) { echo
"checked"; }?>> Visa<br>

MySQL database fields ...
delta binary(1) No 0
mastercard binary(1) No 0
solo binary(1) No 0
switch binary(1) No 0
visa binary(1) No 0

When I output the fields, I get "on" or empty, and am wondering whether I am
making a good decision to do the code this way. Now I need to figure out how
to update the database based on the forms output.

Securing PHP/MySQL Forms
I am now building a website + cms, again with PHP/MySQL, however this times its a little different. The website will have a form that customers use to make bookings.

they will enter their names/contact details into this form, as well as their credit card details. however, this transaction is not processed, it is instead saved to their database temporarily. The website owner then needs to login to the cms, process their data manually, then delete the credit details.

I already have set up SSL on the webserver (which is also a static ip server and apparently more secure) so that the php form is https://
but i am wanting to know whether i should be putting other measures in place? ie PHP/MySQL security. is there anything i can do to make ensure that the details will be submitted to mysql database securely and will remain safe in the database.

Problem With HTML Forms And PHP/MySQL...
I hope its simple for you...

Say a user enters "Mark's House" (without the double quotes) into a form
field.

The form is submitted, and the data is entered into the database.

When a query is made on that record, it correctly returns "Mark's House"
(without the double quotes)

But when the data is inserted into a form field (so that the data can be
edited) only "Mark" appears in the form, everything after the ' is ignored.

What is the most elegant way to avoid this. I don't really want to have to
make users escape these characters with . Is there another way?

Comparing Form Data To Mysql Data
Im interested in building a script that would take form data, a variable like an address, and compare it with a known address in a mysql table (called addresses), then if there is a match log the address information in a separate table called (addresslog), and return the visitor to a certain page. If there is no match between the address entered in the form and known addresses then the information is still logged into the addresslog database but the visitor will be sent to a different page.

I'm still new to this, and am working through the logic and the syntax, but I believe I'm close. It's still not working, I have all of the proper tables, maybe I'm way off with the coding so I thought I would seek out some expert advice. Here's the entire script with as much explanation as I could give. PHP Code:

Bypassing "submit" Or Auto Submit With Forms Data
In a regular HTML screen where you have inputs within a FORM, you usually have a SUBMIT input tag to submit the form data to the action'ed item in the form tag.

In alot of sites, I see that you can enter a field, then to its immediate right, is a GO button to submit the choice. Has anyone had experience with this, and if so, how would you code that in PHP? I have also seen where you can choose something from a dialog box, and as soon as its chosen, the form data is submitted. Is that possible in PHP also?

Php Script Generated By Php
I am trying generate a new PHP file from an existing page using PHP. Currently I'm using the output buffer to capture content destined for the page, and then am capturing that output and writing to a file.

The problem I am having is that all PHP scripts within the new page content are executed and the results are written to the new file, when I would like the PHP code itself to be written to the new file, unprocessed.

So now I am trying to just store the new page as a string and bypass the use of the output buffer, but do not know how to store php code within a string without having it execute...

Using Php Generated Pictures With HTML?
I am able to create images with the use of the GDLIB.
but I am not able to use these images together with HTML. I always get the
message "headers are already sent.

I Am Trying To Pipe In Some Auto-generated PHP Into Php.exe
I am trying to pipe in some auto-generated PHP into php.exe, to no
avail:

How To Farmat Php-generated Table
the font size declaration seems to be ignored. Is it possible to set format for
tables generated with php?

<?php

echo "<table border=1 font size=8>";
echo '<tr><th font size=8>Date</th>
<th>IP Address</th>
<th>Operating System</th>
<th>Browser</th>
<th>Referring Page</th>
<tr>'

?>

Php-generated Png Transparency Issue In IE
I've been trying to get my page, which works perfectly in Firefox, to work in IE as well. one problem was getting the .png images to display properly, which was fixed by doing this:

filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='imagename.png')

but what of php-generated .png files? putting the php file as the src doesn't work. the php-generated images don't work at all in IE (but work fine in firefox).

(the php-generated image uses a transparent color made with imagecolorallocatealpha. when I just use imagecolorallocate it shows up, but is not transparent as I want it.)

Generated Images Not Printing?
I have a problem with IE and generated images (jpgraph). It displays
them fine but it's not printing them. They appear as little red crosses
in print preview.

I've fiddled with the cache control headers as I thought that was it.
Certainly IE refuses to cache pdf files sent using fpassthru and cannot
open them in acrobat.

Server Generated PDF Files?
Heres what I need to happen now, I know how to do most of it, except the generated PDF form.

- The server puts that information into a PDF file with a background of my chosing and emails it to a specified adress. (Its already set up to send the email)

My issue is I dont know how to have the server generate the PHP form. How does it work? How do I position the text over the PDF automatically?

I'm already donating $10 to the site, thanks to the help I received from UTAlan, Lytheum, and Waldir. Ill make it a total of $20 after this.

Image Src Generated Through Php File
I've built a custom image gallery, integrated with a database. all of the images are kept above the document root in a "media" directory (for security purposes); therefore, i am using a php script in the src attribute of the image tags to display the image in the browser.

to accomplish this, i chose to use the PEAR package "HTTP_Download", which worked great and performed fantastically on my staging server.  I chose to use content-disposition inline, and set caching options on.

the problem, the images don't cache on a users machine.  therefore, everytime the page is changed to display a new image, all of the thumbnails are downloaded once again...very annoying. let me re-iterate, these files are not being generated on the fly, simply sent to the user via php. Code:

Mail A Php Generated Page
I ask if it's possible to sent to email a php generated page as an html attachment or text file !?

I have searched on google, but I find only how to send mail from php not hot to send a page.

Any link, or doc is helpfull !

The story:
I have a long products list, from where I select some items what I want to send as a price list to some people.

PHP-generated RSS Feeds And .xml Files
I want to make an RSS feed for my site.  Obviously, it should be dynamic, so the only way that comes to mind is to use PHP to create the RSS.  But then the filename will be .php.  Most of the sites I see with feeds (digg, shoutwire, cnn, etc) have .xml files.  How do they do this? I would like to have a .xml that is dynamic/always up-to-date.

Get Mysql Data
I have a database, and what I want is for people to be able to put in a number from the database and it pull up their info and put into a form, so then they can just add to what they already had.

Data And Mysql
I want column XY be unique so:

 xy | gg | zz | ee
 12 | df | df | fd
 13 | df | df | fd

I want to enter more data but it might enter 12 | df | df | fd again so i would get an error. How would i prevent that without having to loop threw the whole database checking for that entry?

Getting Data With MYSQL
IM interested in knowing of any better ways of retreiving data from mysql and if my current way is safe as i request it over all my scripts.

$information = mysql_fetch_row(mysql_query("SELECT `row` FROM `table` WHERE `username` = 'Memphis'"));

print("$information[0]");

Problems Saving Gd Generated File
I'm using the gd library to build graphs from db generated data. I can output the result to the browser with no problems, but when I try to save the image, I get the following error message.

PHP Generated Pages & Search Engines
I'm trying to get a basic idea of how well PHP generated pages can be spidered by search engines? I'm working for a company that keeps two versions of it's site at the moment. One copy run off of a database using CGI, and one copy entirely in HTML so search engines will find them. I've told them that this is just a bad idea, and far too time consuming. I'm under the impression that PHP pages can be found by search engines, am I wrong? I'm going to be running almost their entire database of products off of one file, will the search engines be able to find these if there aren't direct links to them?

Any other suggestions as to how to keep their positions in the search engines (very good right now) would be appreciated as well.

PHP 5 Compilation Error: Libphp5.so Is Not Generated
I started from a clean, new system, with only SSH and Webmin. It's a VPS running on Fedora Core release 2.

1) I added my domain name to the BIND server

2) I downloaded the last stable Apache version, 2.2.3, and installed it
using:

./configure --prefix=/usr/local/apache --enable-so --enable-module=rewrite
make
make install

3) I tested it, it worked.
4) I downloaded the last stable PHP version, 5.1.6, and installed it using
the MINIMUM configuration possible (not even MySQL):
./configure --with-apxs2=/usr/local/apache/bin/apxs
make
make install

"make install" gave me that error:
==================================

[root@server php-5.1.6]# make install
Installing PHP SAPI module: apache2handler
/usr/local/apache/build/instdso.sh
SH_LIBTOOL='/usr/local/apache/build/libtool' libphp5.la
/usr/local/apache/modules
/usr/local/apache/build/libtool --mode=install cp libphp5.la
/usr/local/apache/modules/
cp .libs/libphp5.lai /usr/local/apache/modules/libphp5.la
cp .libs/libphp5.a /usr/local/apache/modules/libphp5.a
ranlib /usr/local/apache/modules/libphp5.a
chmod 644 /usr/local/apache/modules/libphp5.a
libtool: install: warning: remember to run `libtool --finish
/root/zzz/php-5.1.6/libs'
Warning! dlname not found in /usr/local/apache/modules/libphp5.la.
Assuming installing a .so rather than a libtool archive.
chmod 755 /usr/local/apache/modules/libphp5.so
chmod: cannot access `/usr/local/apache/modules/libphp5.so': No such file or
directory
apxs:Error: Command failed with rc=65536

==================================

The problem is that libphp5.so is not generated from "make".

I found those related links:
http://www.fedoraforum.org/forum/archive/index.php/t-23665.html
http://bugs.php.net/bug.php?id=27795

Following the recommendations I tried:

1) using the bz2 version of the PHP distribution and not the gz one

2) I installed getText ( http://www.gnu.org/software/gettext/ ) because some
say an included library, "libintl.so", could help. But I couldn't find that
library after getText was sucessfully compiled.

3) I chomed everything to 777 in the php directory

4) I installed the last stable libtool, 1.5.22

Nothing worked, I still have that libphp5.so error.

Any help would be really appreciated. And I really mean it!

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

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

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

Are Multiple GD Generated Images Possible On One Page?
I've been experimenting with generating PNG files via PHP and GD. All was going fine, until I tried to put more than one image on a single page.

<img src="draw.php?text=Picture1"><br>
<img src="draw.php?text=Picture2"><br>
<img src="draw.php?text=Picture3"><br>

The example above produced 3 images, but they all have 'Picture3' on them. Seems like theres only 1 temp storage area for the images?

Strange File Auto Generated?
I am using Linux/PHP4 + Smarty, sometimes I found some strange file
auto generated under the temp folder for smarty cache,

e.g. phpNd7W05

Anyone know the reason for this file?

How To Handle Special Characters In RSS Generated By PHP?
I generate RSS 2.0 using PHP from mysql DB, for example:
echo "<title>" . $title . </title>";
echo "<link>" . $link . </link>";
echo "<description>" . $description . "</description>">

The problem is, sometime there are special characters in $description or $title, for example, trademark symbol. Is there a function which can remove these characters? I tried to use htmlspecialchars ($description), which only work with HTML tags.

Open URl Wich Is Generated By A Script?
I just started to get in touch with php
and use it as extension of
my Java Applets.....

How can I open a URL wich is of this kind:

http://www.host.com/?alotofdata

right now I use this script:

<?php
echo(" <W> ");
echo($key);
$file = fopen ($key, "r");
$contents = "";
while (!feof($file))
{
$contents .= fread($file, 8192);
}
fclose($file);
echo($contents);
?>

the first two lines are mere debugging help
the key ist set to the right URL
but it only receives
what it would get if I open the Address:

http://www.host.com/

is there a way to open the right connection?
(hopefully in an easy way)
maybe I searched for the wrong keywords but
google didn't bring anything

Loading Times For Php Generated Pages
I've just noticed on my own surfing of the net and some php pages that i've done. especially long pages.... that they seem to load in blocks... one section at a time

is there some sort of buffering or something that is doing this and can be turned off? I"m not that experienced in php... but know enough.

Storing Pictures Generated Witn GD
I'm trying to make php store a picture (on the server) that have been resized by GD. The picture is downloaded from a browser. But I would like to store this file in different sizes. To save downloadtime and cpu-power I wish to do this only once while downloading the file to the server.I can resize files, but I'm unable to store them.

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

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

Php File As String Generated To Html
I have a page going on a local server but the pages are going to be hosted on another server, which doesn't support php and MySQL. So basicly have to generate the php files into html files. The pages on the localserver are all based on a template page Main.php?Cat=Home

So this is what I'm trying to do. either...open the php template pages in another file then write them as html or...export the php template as html when viewed.So far all I got to see is resource id # 1 Just a little push on the file handling as a string would be much appriciated.

Passthru + Auto Generated Headers
I'm slightly confused with the passthru() command. The program I call writes
html headers itself. However, passthru() makes apache sending some generated
headers first. There's no fault with spaches in the code etc, I think.
Here's an simplified example:

$ cat /www/example.php

<?
passthru("cat /tmp/output");
?>

$ cat /tmp/output
Content-Type: text/html

<HTML><HEAD></HEAD>Message</BODY></HTML>

$ curl -i "http://localhost/example.php"
HTTP/1.1 200 OK
Date: Sat, 16 Jul 2005 14:47:29 GMT
Server: Apache/2.0.54 (Unix) mod_ssl/2.0.54 OpenSSL/0.9.7d DAV/2 PHP/5.1.0b3
X-Powered-By: PHP/5.1.0b3
Content-Length: 66
Content-Type: text/html

Content-Type: text/html

<HTML><HEAD></HEAD>Message</BODY></HTML>

Highlight Dynamically Generated Text
I have a search form which makes queries to a database. In the form the user can search for many words (word1 && word2 && word3). I want in the results to highlight the words that the user has searched for. I 've searched in the internet and i've found some codes but none of them works with all the possible results.

What I have found so far which is closer to what I want is the following:

Magpie RSS Rejects PHP Generated RSS Feed
Can any see why Magpie RSS won't accept this RSS Feed (that is valid
according to the Feed Validator website).

This is the code that generates it. A SQL query is run first into
$result and then:


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