Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 199807

Re: [PHP3] Front Page and PHP3 From: Barry Voeten (barry <email protected>)
Date: 07/09/98

> Steve Lawrence wrote:
>
> For those of you using front page, I have written some code to help
> display values in forms (extracted from database) and insert values
> from forms (to database). these scripts only work on Javascript
> browsers.

.. which is a bummer for thosu running lynx from a unix console.
We have solved the same problem by including php files which hold the
functions
executed in a frontpageable php file. These are functions like showradio
and
showinput.

barry

> The first part is a function:
> <?
> function JavaFormVal ($form,$vals){
> // $form is name of form
> // $vals is array of values to output
> // call this function after desired form to populate
> // to build array: $val["var1"] = $var1; $val["var2"] = $var2;
> // syntax to call: JavaFormVal("Form",$val);
> print("<script LANGUAGE='JavaScript'>\n");
> print("<!--\n");
> while(list($var,$val) = each($vals)){
> print("document.$form.$var.value = '$val'\n");
> }
> print("// -->\n");
> print("</");
> print("script>\n");
> }
> ?>
> The second piece extracts info from database, and writes javascript to
> update form. You should put this part after your form.
> <?
> // Get values for form from database
> $db = "database";
> $table = "table";
> $column = "column";
> $value = "value";
> $query = "select * from $table WHERE $column = $value";
> $select = mysql($db,$query);
> echo mysql_error();
> if(mysql_numrows($select) > 0 ){
> $array = mysql_fetch_array($select);
> $row=0;
> while(list($var,$val) = each($array)){
> if(gettype($row/2) == "double"){
> $variable[$var] = $val;
> }
> $row++;
> }
> JavaFormVal("Vendor",$variable);
> }
> ?>
>
> The third part takes the form values and puts it into the table:
>
>

-- 
+++++++++++++++++++++++++++++++++++++++++
+  Barry Voeten barry <email protected> +
+  Netland Internet Services  Amsterdam + 
+  Web Engineering  Design  Hosting     +
+  www.netland.nl + 31 (0) 20 6943664   +

--
PHP 3 Mailing List   http://www.php.net/
To unsubscribe send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest list:  php3-digest-subscribe <email protected>
For help: php3-help <email protected>  Archive: http://www.tryc.on.ca/php3.html