[PHP] get question

2012-08-27 Thread Jack S
Hello All,

Trying to figure out why when I include the page that contains this
code, I'm not able to get the $calling_page populated with any values.
Any help appreciated...


?
# Dynamic Content based in page
$calling_page = $_GET['page'];

# Home Page 
--
if(!($calling_page)) {
$title = Title 1 - $calling_page;
$body = body /;

} elseif ($calling_page == index) {
$title = Title 2 - $calling_page;
$body = body /;

# Non Specified Page
--
} else {
$title = Title 3 - $calling_page;
$body = body /;

}

echo title.$title./title;
?


-- 
Thanks!
Joey

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] help with query

2012-06-07 Thread Jack
Hello All,

 

I have this string defined for my query and it shows the different types of
categories fine, but when I change a.categoryid = c.categoryid to
a.categoryid = 1 which is only one of the categories

It shows me the same record twice.

 

$query = select a.startdate, a.articleid, c.name, a.title, a.intro,
a.datecreated from articles as a, categories as c where (a.startdate = -1 or
a.startdate = {$now}) and (a.enddate = -1 or a.enddate = {$now}) and
a.categoryid = c.categoryid order by a.startdate DESC;

 

 

while ( $row = mysql_fetch_array($res) ) {

$tpldata['articles'][] = array(

'title' = $row['title'],

'intro' = makeLinks($row['intro']),

'id'= $row['articleid'],

'categoryname'  = $row['name'],

'created'   = date('n/j/Y',
$row['datecreated'])

);

//echo $row['datecreated'];

}

 

Any Ideas???

 

 

Thanks!

 



RE: [PHP] help with query

2012-06-07 Thread Jack Sasportas
Thanks Jim, worked like a charm.

 -Original Message-
 From: Jim Lucas [mailto:li...@cmsws.com]
 Sent: Thursday, June 07, 2012 4:08 PM
 To: Jack
 Cc: PHP
 Subject: Re: [PHP] help with query
 
 On 06/07/2012 09:37 AM, Jack wrote:
  $query = select a.startdate, a.articleid, c.name, a.title, a.intro,
  a.datecreated from articles as a, categories as c where (a.startdate =
  -1 or a.startdate= {$now}) and (a.enddate = -1 or a.enddate= {$now})
  and a.categoryid = c.categoryid order by a.startdate DESC;
 
 $query = 
   SELECT  a.startdate,
   a.articleid,
   c.name,
   a.title,
   a.intro,
   a.datecreated
   FROMarticles as a,
   categories as c
   WHERE   (
   a.startdate = -1
   OR
   a.startdate = {$now}
   )
   AND (
   a.enddate = -1
   OR
   a.enddate = {$now}
   )
 -- This line must stay, it is limiting the combination of the data from
 -- both tables
   AND a.categoryid = c.categoryid
 -- You need to add this line to make it work, but keep the previous line
   AND a.categoryid = 1
 
   ORDER BY a.startdate DESC
 ;
 
 --
 Jim Lucas
 
 http://www.cmsws.com/
 http://www.cmsws.com/examples/
 http://www.bendsource.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Split

2011-12-13 Thread Jack
OK so I have seen enough errors about split, so I decided to update my code:

  return split(/, $sPath, $iMax);

 

I tried:

return preg_split(/, $sPath, $iMax);

return preg_split(/, $sPath, $iMax, PREG_SPLIT_DELIM_CAPTURE);

 

and a few other combinations, in the end always with errors. not sure I get
the additional aspect.

I do see ther error log it tells me no ending delimiter

 

Any help appreciated.

 

 

Thanks!

Jack

 



[PHP] Problem with date

2011-12-07 Thread Jack
Hello All,

 

I have a problem where Dates are coming out as 12.31.1969 19:00:00 which of
course we didn't have PC's in 1969

I'm not able to see where the date is getting screwed up, any ideas??

 

//

#

function ShowFeed_RSS($XmlRoot) {

  $title = GetFirstChildContentByPath($XmlRoot, channel/title);  

  $link = GetFirstChildContentByPath($XmlRoot, channel/link);  

  $desc = GetFirstChildContentByPath($XmlRoot, channel/description);

# Next 2 lines display the title of the feed, and feed description


#  echo font face=arial color=blue size =2ba
href=\$link\$title/a/b\n;

#  echo $desc;

  $nodelist = GetChildrenByPathAndName($XmlRoot, channel, item);

  if (!$nodelist) return 0;

  foreach ($nodelist as $nl) {

$title   = GetFirstChildContentByName($nl, title);

$link= GetFirstChildContentByName($nl, link);

$desc= GetFirstChildContentByName($nl, description);

$creator = GetFirstChildContentByName($nl, author);

 

#if (!$creator) $creator = GetFirstChildContentByName($nl,
dc:creator);

 

#   echo JACK . $nl . br;

#$pubdate = GetFirstChildContentByName($nl, pubDate);

if (!isset($pubdate)) $pubdate = GetFirstChildContentByName($nl,
dc:date);

#if (!$pubdate) $pubdate = GetFirstChildContentByName($nl, dc:date);

if (isset($pubdate)) $pubdate = strtotime($pubdate);

if (isset($pubdate)) $pubdate = strftime(%m.%d.%Y %H:%M:%S, $pubdate);

$out = $creator;

 

if ( ($creator != )  ($pubdate != ) ) $out .=  @ ;


$out .= $pubdate;

echo a class=\rss-link\ href=\$link\b$title/b/a;

echo font size=1 color=\black\$outbr;

echo font size=2$descbrbr;

#   echo font size=1 class=rss-linkThis is not green/font;

 

}

#  this line is after each rss feed group

#  echo hr\n;

 

}

 

 

 

Thanks!

Jack

 



RE: [PHP] Problem with date

2011-12-07 Thread Jack Sasportas
 
 
   How about a little debugging here (and possibly elsewhere):
 
   if (isset($pubdate)  ($pubdate 0)) {
  $pubdate=strtotime($pubdate);
   } else {
  die(Barf.  Can't run a string to time conversion on 0 or -1.);
   }
 

Thanks Kevin,

This bombs and gives me the BARF!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Problem with date

2011-12-07 Thread Jack
How about a little debugging here (and possibly elsewhere):
 
if (isset($pubdate)  ($pubdate 0)) {
   $pubdate=strtotime($pubdate);
} else {
   die(Barf.  Can't run a string to time conversion on 0 or
-1.);
}
 
 
Thanks Kevin,

This bombs and gives me the BARF!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Problem with date

2011-12-07 Thread Jack
 To: PHP
 Subject: RE: [PHP] Problem with date
 
 
 
How about a little debugging here (and possibly elsewhere):
 
if (isset($pubdate)  ($pubdate 0)) {
   $pubdate=strtotime($pubdate);
} else {
   die(Barf.  Can't run a string to time conversion on 0 or
-1.);
}
 
 
 Thanks Kevin,
 
 This bombs and gives me the BARF!
 

FYI the date field is stored in a MySQL DB as a datetime type


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Help with redeclare error

2011-10-28 Thread Jack
 
 A function with that name already exists in PHP as of 5.3.0. You'll have
to
 rename it or something.
 
 http://us2.php.net/manual/en/function.date-diff.php
 

That looks like what happened that new function was added and we had written
one with the same name from the stone age...

Thanks!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Help with redeclare error

2011-10-27 Thread Jack
Hello All,

 

I have some code that just broke with a PHP upgrade, the error says:

PHP Fatal error:  Cannot redeclare date_diff() the line of the error is the
close bracket of the function which is below.

Any ideas what's going on, I'm stuck?

 

 

 

function date_diff($start_time, $stop_time) {

 $seconds   = strtotime($stop_time)-strtotime($start_time);

$days  = intval($seconds/86400);

$seconds  -= $days*86400;

$hours = sprintf(%02d,intval($seconds/3600));

$seconds  -= $hours*3600;   

 $minutes   = sprintf(%02d,intval($seconds/60));

$seconds  -= sprintf(%02d,$minutes*60);   

 

# $time_diff = Days= . $days .   Hours= . $hours .   Minutes= .
$minutes .   Seconds= . $seconds;

$time_diff = $hours . : . $minutes;

 return($time_diff); 

}

 

 

Everywhere I call the function it looks like this:

date_diff($fldstart_time,$fldstop_time);

 

 

 

 

Thanks!

Jack

 



[PHP] what's wrong with this php system

2011-08-08 Thread smith jack
I have installed a php system on my pc, it works well, except the head
of the page is a bit strange, there is some warning information, and
occupies lot of space,
what's wrong,  the error information is as follows:
Warning: Parameter 1 to Notice::onPrint() expected to be a reference,
value given in E:\site\admin.php on line 481

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Path question

2011-03-28 Thread Jack
Hello All,

 

Is there a smarter way to do includes by setting up a path or something
where I don't have to include /home/domain.com/includes/include_file.php

Apparently my path is as shown above,  but I would prefer to just put in
/includes/include_file.php

 

 

Thanks!

Jack

 



[PHP] help with _get error

2011-03-23 Thread Jack
Hello All,

 

I'm having a problem with this line of code which worked fine for years:

$l_url2 = ..$_GET[SERVER_NAME];

 

Here is the error:

[Wed Mar 23 13:33:49 2011] [error] [client 16.139.201.61] PHP Notice:  Use
of undefined constant SERVER_NAME - assumed 'SERVER_NAME' in
/home//modules/jack.php on line 322 

 

Thanks!

J

 



[PHP] assistance with php not running properly

2011-03-14 Thread Jack
Hello All,

 

I have a problem where we tried to install mod_security for apache, failed
and backed out of the install.

Were not sure if that's what did it, but when we run certain php scripts
they are no longer working, giving us blank screen ( web browser screen ) no
errors in http error log or php error log.

 

I would like to hire someone to fix this ASAP, but not sure what companies
out there are good apache/php server support guys.  This is a SERVER level
issue, not a programming issue.


Any suggestions appreciated.

 

Thanks!

Jack

 



[PHP] help with a safe mode snag

2011-03-14 Thread Jack
Hello All,

 

Im writing a script that creates a temp file which it then encrypts and
sends out in an email.

This works 100% on servers that don't have safe mode, but this server with
safe mode doesn't understand it's all the same user. 

Error:

Mon Mar 14 21:10:11 2011] [error] [client 14.18.8.43] PHP Warning:  fopen()
[a href='function.fopen'function.fopen/a]: SAFE MODE Restriction in
effect.  The script whose uid is 50069 is not allowed to access
/tmp/A1_mYM5q5 owned by uid 48 in

 

Any suggestions?

 

Thanks!



[PHP] problem with if and exact match

2011-03-14 Thread Jack
I want to be able to match if a string is contained within the string I am
evaluating.

 

I know that if ( $name == xxjacksonxx); based on the below would be true.

But I want to be able to say if jackson  is contained within $name that
it's a match.

 

I tried the below without success..

Not getting the operand properly..

 

?

 

$name = xxjacksonxx;

 

if ( preg_match($name, jackson)) {  

   print true;

 

} else {

 

   print false;

}

 

?

 

Thanks!

Jack

 



RE: [PHP] problem with if and exact match

2011-03-14 Thread Jack
Thanks everyone... great examples...works ( both methods )

Thanks!
Jack

 -Original Message-
 From: Alexis Antonakis [mailto:ad...@antonakis.co.uk]
 Sent: Tuesday, March 15, 2011 1:10 AM
 To: Jack
 Subject: Re: [PHP] problem with if and exact match
 
 http://php.net/manual/en/function.preg-match.php
 
 On 14/03/11 23:02, Jack wrote:
  I want to be able to match if a string is contained within the string
  I am evaluating.
 
 
 
  I know that if ( $name == xxjacksonxx); based on the below would be
 true.
 
  But I want to be able to say if jackson  is contained within $name
  that it's a match.
 
 
 
  I tried the below without success..
 
  Not getting the operand properly..
 
 
 
  ?
 
 
 
  $name = xxjacksonxx;
 
 
 
  if ( preg_match($name, jackson)) {
 
  print true;
 
 
 
  } else {
 
 
 
  print false;
 
  }
 
 
 
  ?
 
 
 
  Thanks!
 
  Jack
 
 
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Shopping cart question

2010-11-05 Thread Jack
Hello All,


I'm looking to build a DB with items that are considered more of a catalog
on one side of a website, and then provide those same items including the
same images, descriptions etc. to a shopping cart.

I don't want to re-invent all of the basic shopping cart functionality and
I'm not sure I want to use something like OScommerce and inject the data
into it at the same time as putting data into our database that we are
writing.


I was hoping someone out there has some suggestions, or even a cart module
that would allow me to easily integrate into.

 

 

Thanks!

Jack

 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Shopping cart question

2010-11-05 Thread Jack
On Fri, Nov 5, 2010 at 12:30 PM, Jack jacklistm...@gmail.com wrote:

Hello All,


I'm looking to build a DB with items that are considered more of a catalog
on one side of a website, and then provide those same items including the
same images, descriptions etc. to a shopping cart.

I don't want to re-invent all of the basic shopping cart functionality and
I'm not sure I want to use something like OScommerce and inject the data
into it at the same time as putting data into our database that we are
writing.


I was hoping someone out there has some suggestions, or even a cart module
that would allow me to easily integrate into.

 

One recommendation I can give you is to spend some time determining if Magento 
works for you.  This is a conventional platform written on top of Zend 
Framework.  OScommerce, and a derivative, ZenCart are ancient, and there are 
many nasty things about the programming practices, most notably, the 'view' 
layer, which is markup intermingled with logic .. its pretty bad.

 

Magento is robust, and has a feature set that makes OScommerce look like it 
shipped from the third world.  That said it may be overkill as well - just my 
2c.

 

-nathan

 

I agree, this is a cart I was going to check into because it has many more 
features and is probably a little more if not a lot more stable than 
OScommerce.  I just am not sure if I want to inject everything, although I may 
not have a choice.

 

Thanks!



[PHP] form post question

2010-10-28 Thread Jack
I have a form which has the following: ( quick clip )

 

  form id=form1 name=form1 method=post
action=http://www.abc.com/processing/process_form.php; onSubmit=return
preSubmit();

 

 label

input name=area_interest type=checkbox id=field13
value=Peer Guide /

Peer Guide/label

  br /

  label

input type=submit value=Submit /

 

When the form runs process_form.php it emails the content and has several
other fields from the form, but I have some fields like the one above that
don't show up in the result.  The script that builds the message looks like
the below

 

$temp_message .= Area(s) of Interest: .
$_POST['area_interest'] .\n;

 

Is there anything obvious that I am missing?

 

Is there a way for me to show all the fields from the form, and their field
names which are received by process_form?

 

 

Thanks!

Jack

 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Show text without converting to html

2010-09-09 Thread Jack
Hello All,


I have some code which converts to some html to ascii characters.  This
basically obfuscates the html code, but shows it correctly on an page.


I am trying to show the results of the obfuscation ( works correctly because
it displays the html value ), but I want to then show the obfuscated html
code so they can copy it.

An example is I want to show them this below:

a
href=#x6d;#x61;#x69;#108;#x74;#111;#x3a;#x79;#x6f;#117;#114;#x4
0;#101;#x6d;#00097;#x69;#x6c;#x2e;#97;#x64;#x64;#x72;#000101;#00
0115;#115;?subject=cc=bcc=body= style= class=
id=#x79;#000111;#x75;#000114;#x40;#x65;#x6d;#97;#105;#x6c;#000
46;#x61;#x64;#x64;#000114;#x65;#000115;#x73;/a

 

Which was created by the code, but I apparently can't seem to echo it and
get it to display like above.. It converts it to html no matter what I do.

 

 

Thanks!

Jack

 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Show text without converting to html

2010-09-09 Thread Jack
-Original Message-
From: Andrew Ballard [mailto:aball...@gmail.com] 


The only people for whom the value will be obscure will be the humans who 
actually try to read the HTML source code itself. Neither web browsers nor 
harvesting scripts won't have any trouble reading it.

Andrew


Andrew,

One other note, if the link doesn't say mailto: a harvester will have to decode 
the entire page in order to find the mailto, do you think that’s happening.  
This could be one of those things where you help against a percentage of 
harvesters, and not others.

J


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Show text without converting to html

2010-09-09 Thread Jack
-Original Message-
From: Andrew Ballard [mailto:aball...@gmail.com] 
Sent: Thursday, September 09, 2010 10:13 AM
To: Jack
Cc: PHP
Subject: Re: [PHP] Show text without converting to html

On Thu, Sep 9, 2010 at 9:52 AM, Jack jacklistm...@gmail.com wrote:

 Hello All,


 I have some code which converts to some html to ascii characters.  
 This basically obfuscates the html code, but shows it correctly on an page.


 I am trying to show the results of the obfuscation ( works correctly 
 because it displays the html value ), but I want to then show the 
 obfuscated html code so they can copy it.

 An example is I want to show them this below:

 a
 href=#x6d;#x61;#x69;#108;#x74;#111;#x3a;#x79;#x6f;#117;#11
 4;#x4
 0;#101;#x6d;#00097;#x69;#x6c;#x2e;#97;#x64;#x64;#x72;#00010
 1;#00 0115;#115;?subject=cc=bcc=body= style= class=
 id=#x79;#000111;#x75;#000114;#x40;#x65;#x6d;#97;#105;#x6c
 ;#000 46;#x61;#x64;#x64;#000114;#x65;#000115;#x73;/a



 Which was created by the code, but I apparently can't seem to echo it 
 and get it to display like above.. It converts it to html no matter what I do.


This should do it:

?php

$var = 'a 
href=#x6d;#x61;#x69;#108;#x74;#111;#x3a;#x79;#x6f;#117;#114;#x40;#101;#x6d;#00097;#x69;#x6c;#x2e;#97;#x64;#x64;#x72;#000101;#000115;#115;?subject=cc=bcc=body=
style= class=
id=#x79;#000111;#x75;#000114;#x40;#x65;#x6d;#97;#105;#x6c;#00046;#x61;#x64;#x64;#000114;#x65;#000115;#x73;/a';


echo  htmlspecialchars($var);

?

The obfuscation doesn't buy you much, though.

?php

var_dump(html_entity_decode($var, ENT_QUOTES, 'utf-8'));

?
string(106) a
href=mailto:y...@email.address?subject=cc=bcc=body=; style=
class= id=y...@email.address/a

The only people for whom the value will be obscure will be the humans who 
actually try to read the HTML source code itself. Neither web browsers nor 
harvesting scripts won't have any trouble reading it.

Andrew


Hi Andrew,

I thought this was suppose to help against many of the havesting scripts?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Open Source SEO tool

2010-07-06 Thread Jack
Hi Ashley,


Yes, I would have to have a list or pass parameters to tell it a domain name, 
some key words and then gather the results.

This is something similar to what Peter has posted and gives me a starting 
point I believe. 


My thought is I would email myself the current position ( on that day ) for my 
domain and I would then know if changes or content which are on the site are 
helping to improve that position as well as kind of a warning when it’s 
slipping down the returned results which would mean were going to loose 
traffic….

 

 

Thanks!

Jack

 

From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: Tuesday, June 29, 2010 1:09 PM
To: Jack
Cc: PHP
Subject: Re: [PHP] Open Source SEO tool

 

On Tue, 2010-06-29 at 13:02 -0400, Jack wrote: 

 
Hello All,
 
 
Does anyone know of an open source tool for SEO that would check your
positioning in the search engines and then email a result?
 
Probably something that runs in cron and executes daily weekly etc?
 
 
 
Thanks!
 
Jack
 
 

It sounds like a simple question, but it isn't really. What search terms do you 
want to check your positioning for? What locations (as many search engines are 
putting a bias on results by location now)

Perhaps look at one of the visitor tracking solutions, which might be able to 
give you an idea of the search terms people have used to find your site, and 
then give the position based on that search? I know Googles own analytics 
software does this, although the results there are a little inaccurate.


Thanks,
Ash
http://www.ashleysheridan.co.uk



 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Open Source SEO tool

2010-06-29 Thread Jack
Hello All,


Does anyone know of an open source tool for SEO that would check your
positioning in the search engines and then email a result?

Probably something that runs in cron and executes daily weekly etc?

 

Thanks!

Jack

 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Zip Search

2010-04-15 Thread Jack
Hello All,

 

Can anyone recommend a good open source zip code search application and
database?

 

 

Thanks,

 

Jack

 



[PHP] contant /

2010-04-08 Thread Jack
I get a couple of errors like this one for undefined variable:

PHP Notice:  Undefined variable: s_company_name

And this one for undefined contstant

PHP Notice:  Use of undefined constant account_type - assumed 'account_type'

 

I am putting a piece of code from each so that hopefully someone can explain
what I need to do to correct this, I know it still runs OK, but want to
eliminate error/warnings as much as possible.

 

 

CONSTANT CODE:

if($_POST) {

 

 

   if($username  $password)

  {

  f_db_open();

  $q = mysql_query(SELECT * FROM uas_users WHERE
user_email='$username');

  $auth = mysql_fetch_array($q);

 

  if($auth['user_password'] == $password  $auth['user_email'] ==
$username  $auth['account_status'] == Approved)

 {

 

 

 $type = $auth['account_type'];

 

   mysql_query(INSERT INTO logon_log (user, date, time)
VALUES ('$username', NOW(), NOW()));

 

 
f_put_cookie($auth[user_name],$auth[user_email],$auth[account_type],$auth[co
mpany_name]);

 

 

VARIABLE CODE:

function f_option_menu($status_message ) {

global $s_url, $s_logo, $s_logo_h, $s_logo_w;

 

echo 

table border='0' width='100%' cellpadding='0' cellspacing='0'

  tr

td

  img border=0 src='images/.$s_logo.' width=.$s_logo_w.
height=.$s_logo_h.

  font face='Verdana, Arial' size='3'b.$s_company_name.
.$status_message./b/font

 

 

THANKS

 

 

 

Thanks!

Jack

 



[PHP] outlook calendar entry on the fly

2010-03-11 Thread Jack
Does anyone have any reference to some php code which would allow me to have
a person go to a website, pick an appointment time and date and then create
a clickable link which could populate outlook with the appointment.  I
believe this is an .ics file which outlook needs/reads.

 

 

Thanks!

Jack

 



Re: [PHP] dynamic meta tag and title app?

2009-11-19 Thread Jack S
Hi Todd,

This looks like a good starting point for me.
I was going to use $_SERVER['PHP_SELF'];  but I think
($_SERVER['SCRIPT_NAME']); in your example will always return just the
script info and not additionally passed information, which will save
me trouble shooting later!

Thanks!!!


On Thu, Nov 19, 2009 at 10:09 AM, tedd tedd.sperl...@gmail.com wrote:
 At 11:30 AM -0500 11/18/09, Jack S wrote:

 Hello All,

 Does anyone have a reference to a program that may be out there to
 help with using a single header.php for a site, but then dynamically
 loads different keywords , titles etc based on what page is including
 the header file?

 Sample:
 If home page include it knows the title and other variables would be
 home, about us would be about etc.

 --
 Thanks!
 Jack

 Jack:

 I do this for my site. It's pretty simple -- please follow:

 head
 ?php
 $self = basename($_SERVER['SCRIPT_NAME']);

 switch($self)
   {
   case 'index.php':
   ?
   titleTitle of Index Page/title
   meta name=keywords content=Keywords for Index Page
   meta name=description content=Description for Index Page
   ?php
   break;

 and so on.

 Cheers,

 tedd

 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com




-- 
Thanks!
Jack

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] dynamic meta tag and title app?

2009-11-18 Thread Jack S
Hello All,

Does anyone have a reference to a program that may be out there to
help with using a single header.php for a site, but then dynamically
loads different keywords , titles etc based on what page is including
the header file?

Sample:
If home page include it knows the title and other variables would be
home, about us would be about etc.

-- 
Thanks!
Jack

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Catalog APP

2009-10-29 Thread Jack
Hello All,

 

Has anyone used a good catalog app ? ( sort of like a shopping cart, but to
show off products and not sell them )

Hopefully something with templates so we can tweak the look easily.

 

Thanks!

Jack

 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] distinguish between null variable and unset variable

2009-01-21 Thread Jack Bates
How can I tell the difference between a variable whose value is null and
a variable which is not set?

// cannot use === null:

ket% php -r '$null = null; var_dump(null === $null);'
bool(true)
ket% php -r 'var_dump(null === $unset);' 
bool(true)
ket% 

// - cannot use isset() either:

ket% php -r '$null = null; var_dump(isset($null));'   
bool(false)
ket% php -r 'var_dump(isset($unset));'   
bool(false)
ket% 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] get file from object

2009-01-06 Thread Jack Bates
How do I get the file where a class is defined, from an instance of that
class?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: runtime access to static variable

2008-12-17 Thread Jack Bates
 this does beg the question why don't you know the classname at runtime.. 
 seems to be a slight design flaw and may make sense for you to post the 
 full problem (you must have chosen to implement this for a reason..)

The full problem is: I started off with a DeployTask for deploying a
new instance of my web project to DreamHost:
http://cgi.sfu.ca/~jdbates/tmp/php/200812170/DeployTask.class.phps

(It is a task in the symfony framework, but basically the
DeployTask::execute() method gets called)

The task takes about thirty minutes to run, so I broke it up into steps.
After each step, it updates a database row so that a user who started
the task through a web interface can monitor its progress.

Great so far. Now I decided to create an UpdateTask for updating
deployed instances to the latest version of my code:
http://cgi.sfu.ca/~jdbates/tmp/php/200812170/UpdateTask.class.phps

Of course it also takes a long time to run, so my first iteration just
extends the DeployTask and defines different steps. UpdateTask inherits
DeployTask::execute(), which drives the steps and updates the database.

Unfortunately, in the inherited DeployTask::execute(), self::$STEPS
does not refer to UpdateTask::$STEPS, it refers to DeployTask::$STEPS
: (

I gather with late static bindings in PHP 5.3, static::$STEPS does
what I want? Anyway, DeployTask::execute() is not static, so I know
whether $this is an instance of DeployTask of UpdateTask:
get_class($this) returns it. Which brought me to my contrived example:

ket% cat test.php 
?php

class Test
{
  public static
$STEPS = array(
  'foo',
  'bar');
}

$className = 'Test';

var_dump($className::$STEPS);
ket% 

Except that in real life, $className = get_class($this)

 Check this out:
 http://us2.php.net/manual/en/language.oop5.static.php
 
 It actually won't work until 5.3.0 when they add late static binding.

I ran my contrived example with PHP 5.3alpha3, and it worked!
$className::$STEPS is not a parse error in 5.3, which is cool : )

Except that in 5.3, I will probably just use static::$STEPS anyway : P

In the meantime, I will probably use reflection as suggested:

// HACK: Use static::$STEPS in PHP 5.3:
// http://php.net/oop5.late-static-bindings
$class = new ReflectionClass($this);
$steps = $class-getStaticPropertyValue('STEPS');


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] runtime access to static variable

2008-12-16 Thread Jack Bates
How do I access a static variable when I do not know the name of the
class until runtime?

I have the following example PHP:

ket% cat test.php 
?php

class Test
{
  public static
$STEPS = array(
  'foo',
  'bar');
}

$className = 'Test';

var_dump($className::$STEPS);
ket% 

Unfortunately when I run it I get:

ket% php test.php 

Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM
in /home/jablko/trash/test.php on line 13
ket% 

I can call a static function using call_user_func(array($className,
'functionName')), and I can access a class constant using
constant($className.'::CONSTANT_NAME'). How do I access a static
variable?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] new $foo-className(); Class name must be a valid object or a string

2008-05-03 Thread Jack Bates
I am trying to load PHP objects stored in a database, where the class
name is stored in a column:

$object = new $resultSet-getString(1);

This fails for the same reason that the following fails:

?php

class Foo
{
  public function className()
  {
return 'Foo';
  }
}

$foo = new Foo;
$bar = new $foo-className();

Fatal error: Class name must be a valid object or a string in test.php
on line 12

I guess this error is due to the confusion of parsing () as the
argument list for the className function, or the Foo constructor...

I work around this error by using a temp variable:

$tmp = $foo-className(); $bar = new $tmp;

- however the above reads like hacky code : (

When calling dynamically named functions, I generally use
call_user_func() to avoid awkwardness with $object-$tmp($arg1, ...)

In other words, I prefer:

call_user_func(array($object, 'get'.$someName), $arg1, ...);

- to:

$tmp = 'get'.$someName; $object-$tmp($arg1, ...);

However there does not appear to be an analog of call_user_func() for
constructing new instances of dynamically named classes?

If I recall correctly, there was also a way to work around calling
dynamically named functions (e.g. $object-$tmp($arg1, ...);) using
curly braces:

$object-{'get'.$someName}($arg1, ...);

- however I cannot recall the exact syntax.

Can anyone confirm that there is a curly brace syntax for calling
dynamically named functions? Could it be applied to instantiating
dynamically named classes?

Can anyone recommend a cleaner alternative to:

$tmp = $foo-className(); $bar = new $tmp;

Thanks and best wishes, Jack


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] munge / obfuscate ?

2008-03-28 Thread Jack Sasportas
 -Original Message-
 From: Robert Cummings [mailto:[EMAIL PROTECTED]
 Sent: Thursday, March 27, 2008 10:02 PM
 To: Joey
 Cc: PHP
 Subject: RE: [PHP] munge / obfuscate ?
 
 Hi Joey,
 
 Please keep responses on the list so others can also benefit from the
 learning process.
 
 Comments below...
 
 On Thu, 2008-03-27 at 21:46 -0400, Joey wrote:
   -Original Message-
   From: Robert Cummings [mailto:[EMAIL PROTECTED]
   Sent: Thursday, March 27, 2008 9:28 PM
   To: Joey
   Cc: PHP
   Subject: Re: [PHP] munge / obfuscate ?
  
  
   On Thu, 2008-03-27 at 21:10 -0400, Joey wrote:
Hi All,
   
   
   
I have written an app to allow a person to go online and see a
picture
  we
take of them.  When we link to the picture I don't want it to be
obvious
that the URL is
   
Domain.Com/Pix/123.jpg because the next person we take a picture
of may
  be
123.jpg, so I am trying to munge/obfuscate the URL to make it
less
  obvious.
  
   ?php
  
   $sekret = 'the brown cow stomped on the wittle bug';
  
   $id  = isset( $_GET['id'] ) ? (int)$_GET['id'] : 0;
   $key = isset( $_GET['key'] ) ? (string)$_GET['key'] : '';
  
   if( $key == sha1( $key.':'.$sekret ) )
 
 
 That should have been:
 
 if( $key == sha1( $id.':'.$sekret ) )
 
   {
   header( 'Content-Type: image/jpg' );
   readfile( /images/not/in/web/path/$id.jpg )
   exit();
   }
  
   //
   // Failure... tell them to bugger off :)
   //
   header( 'Content-Type: image/jpg' );
   readfile( '/images/wherever/you/please/buggerOff.jpg' );
   exit();
  
   ?
 
  Sorry to be such a newbie...
 
  I basically would call this function lets say like:
  munge( $url );
 
  end in the end be returned the munged url, however, I don't
understand the
  values you have like the readfile with that url -vs- failure?
 
 I didn't munge... I provided code for a script that sends the
requested
 image if it was requested with the appropriate key (presumably set
 wherever the image was linked). If the key doesn't validate then
another
 image is presented. It can say bugger off, it can say not found,
it
 can say whatever you please. By placing the images outside the web
root
 and using a script like this you are virtually guaranteed the visitor
 can't just request images by making a lucky guess.
 
 Let's say the above script was called: getUserImage.php
 
 Then you might have the following in your HTML:
 
 img

src=getUserImage.php?id=123amp;key=4fad1fea72565105d84cb187d1a3ed3bfb9
aba3b
 /


I understand what is happening here, however I really want something
simple like:

$link =http://www.whataver.com/whateverpath/;;
$image = 123456;

new_image = munge($image);

new_link = $link . $new_image;

or maybe

new_link = munge($link . $image);


Which would encode the whole link.

Either way this is what would go into the email message we send out.

Thanks!





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] redirect stdout to stderr

2008-02-22 Thread Jack Bates
How can I implement in PHP, a script which redirects stdout to stderr,
such that echo, etc. print to stderr instead of stdout?

I can redirect stdout to stderr when invoking PHP like so:

php script-name 2

However I want to perform this redirection within the script itself.

The solution I currently use is output buffering:

ob_start();

// Call library code

fwrite(STDERR, ob_get_contents());
ob_end_clean();

However I wonder if there's a more efficient way, so that output appears
on stderr immediately, rather than waiting for fwrite(STDERR,
ob_get_contents());

My reason for wanting this is to create a Subversion pre-commit hook
using PHP_CodeSniffer: http://pear.php.net/package/PHP_CodeSniffer

I want:

1) Commits to our Subversion repository to be checked against our coding
standard with PHP_CodeSniffer
2) Commits to fail when PHP_CodeSniffer returns an error
3) PHP_CodeSniffer's report to be displayed to the Subversion user, so
they can fix any problems

I achieved 1) and 2), but PHP_CodeSniffer prints its report to stdout
and Subversion only displays stderr to the user, not stdout. So to make
this pre-commit hook fool proof, I want it to redirect PHP_CodeSniffer's
report to stderr.

Anyone have better suggestions than output buffering?

Much thanks, Jack


signature.asc
Description: This is a digitally signed message part


Re: [PHP] php form help...

2008-01-08 Thread Jack Mays


 You think someone who didn't even know how to get post data in the
 first place knows how to properly sanitize it? :)


One would think that the OP would lookup sanitize or some form of that 
search in google to become more familiar with the term and what it 
means, but then again I probably give to much credit to most of the 
population :)


--
Jack Mays

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jack Mays

Jason Pruim wrote:

Hi Everyone,

Happy New Year a week late! :)

I am trying to get more serious with my programming, I feel fairly 
confident in my basic abilities except for one... Error checking. That's 
what I'm trying to get figured out :)


I have a script, that I am using to connect to my database, read, 
insert, delete or edit the records in there.


most of the time the script works perfectly, but on the occassion it 
doesn't like when jupiters third moon aligns with uranus, I want the 
user to be notified to take their head out of their ass... :)


What I have tried is this:

$querytest = INSERT INTO current VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
if ($stmt = mysqli_prepare($link, $querytest)) {


mysqli_stmt_bind_param($stmt, 'ss', $FName, $LName, $Add1, 
$Add2, $City, $State, $Zip, $XCode, $Record, $Reason);

//Add the record
mysqli_stmt_execute($stmt);
printf(Error: %d.\n, mysqli_stmt_errno($stmt));
printf(%d Row Inserted.\n, mysqli_stmt_affected_rows($stmt));



}

//Close the statement
mysqli_stmt_close($stmt);


that was pulled off of the php.net site (For the most part) and adapted 
slightly to meet my needs, and obviously I edited too much of it :)


If anyone has any ideas I would appreciate it. Even RTFM as long as $M 
is defined :)


What, if any, errors are given when the query doens't work?  Are any of 
the field in mysql set to be unique and are you trying to insert a new 
row with some of the same information?


I dont see anything wrong right off the bat with the way you are 
performing the task.


--
Jack Mays

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jack Mays




funnily enough exit is even listed as a function.




LOL, Ignore me, I read that message to fast and read isn't instead of 
is.  It's time to go home and sleep :)


--
Jack Mays

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jack Mays




funnily enough exit is even listed as a function.




Sure it is: http://us2.php.net/manual/en/function.exit.php

Unless I'm missing a point here or something. :)

--
Jack Mays

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] First stupid post of the year.

2008-01-02 Thread Jack Mays

tedd wrote:

Hi gang:

I have a

$submit = $_POST['submit'];

The string contains:

nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp;

(it's there to make a submit button wider)

How can I strip out the nbsp; from the $submit string leaving A?

I've tried

   trim($submit);

but, that don't work.

Neither does:

   $submit = str_replace('nbsp;','',$submit);

or this:

   $submit = str_replace(' ';','',$submit);

I should know what to do, but in this case I don't.

Help is always appreciated.



Just so we have all the info, why are you wanting to do this?  Why not 
just have the button text be what you want it instead of trying to do 
manipulation on it's value?


--
Jack Mays

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] First stupid post of the year.

2008-01-02 Thread Jack Mays

Daniel Brown wrote:

On Jan 2, 2008 2:05 PM, tedd [EMAIL PROTECTED] wrote:

At 1:57 PM -0500 1/2/08, Daniel Brown wrote:

On Jan 2, 2008 1:34 PM, tedd [EMAIL PROTECTED] wrote:

from this:

nbsp; nbsp; nbsp; nbsp;Anbsp; nbsp; nbsp; nbsp;

to this A


?
// Your existing code here
$submit = trim(str_replace('nbsp;','',$submit);


Read the docs for trim, you can't use it inline with other functions, it 
will not trim the input.  you have to seperate it out, e.g.:


 $submit = str_replace('nbsp;','',$submit);
 $submit = trim($submit);



?

Even with adding an additional ), that didn't work either.  :-)



That was a typo on my part, but check it out here and you'll see
it works (you can view full source there, too):

http://pilotpig.net/code-library/tedds-button.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] [pcre] backreferences to all matches of a repeated subexpression

2007-08-01 Thread Jack Bates
I'm trying to pull all the components out of strings structured like:
word followed by any number of ( dot word or square bracketed string )

This is an example: foo.bar[ab.cd].baz

From the above example, I want: array('foo', 'bar', 'ab.cd', 'baz');

A regular expression to match these strings, including parenthesis
around the parts I want to pull out:

preg_match('/(^\w+)(?:\.(\w+)|\[([^]]+)\])*/', $subject, $matches);

However applied to the above example:

$matches[1] = 'foo'; // First subexpression
$matches[2] = 'baz'; // Last value of second subexpression
$matches[3] = 'ab.cd'; // Last value of third subexpression

I'm not sure how to get an array of all subexpression matches, in the
order matches appear in the subject, instead of the order expressions
appear in the pattern.

I think I might be able to do something using the Perl (?{code})
construction, e.g. ...(?:\.(\w+)(?{$parts[] = \2})|\[([^]]+)(?{$parts[]
= \3})\])*... but I haven't thought about it too much because PHP
doesn't support this construction.

Any ideas much appreciated. Thanks, Jack

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB

2007-03-01 Thread Jack Gleeson

Rubbish, where are your benchmarks?


^^ whoever wrote that needs to check the manual before you make bold
statements and my friend it is not 'Rubbish'

On 2/28/07, Richard Lynch [EMAIL PROTECTED] wrote:


On Tue, February 27, 2007 8:03 pm, Kevin Waterson wrote:
 This one time, at band camp, Richard Lynch [EMAIL PROTECTED] wrote:

 *ALL* of the arguments on this topic, and benchmarks, are in the PHP
 General archives.
 I am not concerned with past benchmarks done by others, I am asking
 what
 current benchmarks this user has made to make his claim.

Why?

They'd be no more nor less meaningful than the previous benchmarks to
you personally.

Or maybe I've just lost the thread of conversation here...

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
--

Jack Gleeson
Web Designer


[PHP] LAMP Experts Needed

2006-09-01 Thread Jack Gates
I am looking for some serious coders that want to make a name for 
themselves and/or a lot of money.

I need to talk to any one who is considered an Expert with any of 
these:

Linux
Apache
MySQL or PostgreSQL
PHP, Perl, Python
HTML
CSS
XML
XSL

I am going to convince my employer to replace a very expensive package 
that they are using right now.  This project will take several months 
to complete and then will be on going with a monthly maintenance and 
service.

If you have any interest at all and want to know the details contact 
me.  Send what you can and will do for this project to me at 
[EMAIL PROTECTED]  It is going to be a web interface interacting 
with a very large database.

-- 
Jack Gates http://www.morningstarcom.net

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Best way to get PHP5

2006-08-09 Thread Jack Gates
On Wednesday 09 August 2006 12:02, Chris W. Parker wrote:
 I know that Fedora Core 5 offers PHP 5.1.2 but I've heard some
 negative things about it in general (FC5).

What sort of negative things have you heard in general about (FC5)?

-- 
Jack Gates http://www.morningstarcom.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Best way to get PHP5

2006-08-09 Thread Jack Gates
On Wednesday 09 August 2006 19:24, Jochem Maas wrote:
 Jonathan Duncan wrote:
  On Wed, 9 Aug 2006, Chris W. Parker wrote:
  Jack Gates mailto:[EMAIL PROTECTED]
 
 on Wednesday, August 09, 2006 10:16 AM said:
  On Wednesday 09 August 2006 12:02, Chris W. Parker wrote:
  I know that Fedora Core 5 offers PHP 5.1.2 but I've heard some
  negative things about it in general (FC5).
 
  What sort of negative things have you heard in general about
  (FC5)?
 
  Honestly I don't remember. But I've now got a generally negative
  view of FC5 versus previous versions (last one I used was 4 I
  think).
 
  If you're aware of any FUD that's been spread about it, feel
  free to speak the truth.
 
  If you want to really learn Linux, try Gentoo.  If you just want
  a very good and easy to use Linux, go with SuSE.

 sane words. debian is a good alterative to Gentoo (and there's
 Ubuntu which is a more userfriendly derivative of debian).

 personally I prefer eating razor blade than using something from
 redhat - I have never used FC but if it's anything like RedHat
 Enterprise Server then I'd only use as a bookend (if at all) if I
 were you. ;-)

 FUD-tastic!

  Jonathan

Chris,

Jochem just proved what I said earlier.

Every one has their own preference and some go so far as to claim that 
the ones they just don't like are evil.  That is why there are so 
many different flavors of Linux.  That is also what will continue to 
hold Linux back in the market place and allow the truly evil OS to 
hold there market share on the desktop.

 personally I prefer eating razor blades to using something from
 Redmond Washington

-- 
Jack Gates http://www.morningstarcom.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Shopping Carts

2006-07-08 Thread Jack Gates
On Saturday 08 July 2006 18:31, Michael B Allen wrote:
 I need a (free) shopping cart. The simpler the better. This one is what
 I'm looking for:

   http://www.zend.com/codex.php?id=112single=1

 but it doesn't use current session handling, needs validation, etc.

 Any ideas?

 Thanks,
 Mike

 --
 Michael B Allen
 PHP Extension for SSO w/ Windows Group Authorization
 http://www.ioplex.com/

http://www.oscommerce.com built with PHP and is free.

-- 
Jack Gates http://www.jlgates.com/
http://www.myenergyproducts.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Everything works...Unless they hit the back button...

2005-08-05 Thread Jack Jackson

Kristen G. Thorson wrote:
You said If the user makes changes, those changes get error checked but 
do not become part of the sql query.  Where in your code is it failing 
to become part of the query?  Put a check at each level and see where 
*exactly* it fails to get deep enough to become one with the query.  
Also, I'm confused.  I asked if the query was what you're expecting, and 
you answered yes, which implies the data becomes part of the query.


Thanks for this; yes I was confused before and thank you for the 
clarification.


Now I am confused by how to check the logic: I echo out the sql as it is 
built, and if I'm going forward in the questionnaire it shows clearly but



$qidlist_sql=DELETE FROM teresa WHERE q_id IN ( . 
(implode(,,$qidlist)) . );;

echo br /br /;
echo br /\$ cqidlist_sql: . $qidlist_sql . br /;

   $q_a_sql=INSERT INTO teresa (u_id, q_id, a_id )
VALUES  . (implode(,,$qanda)) . ;;

 mysql_query($qidlist_sql);

echo br /br /;
echo br /\$ q_a_sql: . $q_a_sql . br /;

  if($q_a_result = mysql_query($q_a_sql))
{
  unset($_SESSION['required_fields']);
  $cat = $_POST['cat']+1;
  include_once(QUESTIONS . 'q.inc');
}


 shows NOTHING if I hit the BACK button. I'm still not seeing where the 
logic error is which makes it so that when I hit the BACK button it 
loses the plot.


Sorry for my misunderstanding
JJ







kgt






Jack Jackson wrote:

I've tried playing with the $_SERVER['HTTP_REFERER'] and that's no 
good because it's all coming from the same page - index.php!!


What am I missing. . . ?


Jack Jackson wrote:


Hi Kristen, there's a misunderstanding:

Kristen G. Thorson wrote:

The code below isn't much help to debug.  Do some checking to figure 
out how far into your IF statement you're getting.  Is the query 
running?  





Yes it runs successfully

Is it the query you expect?  





Yes it is perfect, and provided this is a new session and we're going 
forward page by page, it properly deletes from and inserts to the db 
as expected


(Step #1 when inserting or creating dynamic

queries that aren't working: print them out to make sure they are 
what you think they are.)  Is the category being incremented?





Yes, absolutely

You say you can go back, but you can't go forward.  





Actually no. In a new session, I can start and go forward page by 
page to the end of the questionnaire, advancing each stage perfectly, 
storing all values exactly as I'd expect.


The trouble starts if, during the process, the user hits the BACK 
button. At that point, user can reload the last page of questions, 
displaying the answers they gave. If the user makes changes, those 
changes get error checked but do not become part of the sql query. 
Also, user can not move forwards any more. So it's as the subject 
says - everything works...until they hit the back button, from which 
point the whole thing goes gablooey.


Look at the page source, is the


form action what it should be?





Yes

  Look at the form hidden variables (if


any) are they what you expect?




No. $cat remains what it was BEFORE the user hit the BACK button. 
However the questions dispayed are from the $cat which is in fact $cat-1


??!!









--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Everything works...Unless they hit the back button...

2005-08-03 Thread Jack Jackson

Hi all. This has been an interesting week.

Now the form works, and I am able to error check, if no errors look into 
user answer table and delete from that all q_ids matching the ones just 
picked, insert this page of question/answer info (q_id/a_id) into the 
user answer db, and if successful advance the category by 1 and get more 
questions. It works.


I must have a logic error though because for some reason even though I 
say to delete matching  q_ids and reinsert, then move on, if the user 
hits the back button, changes answers and hits submit again, the table 
does not update . .  . and the category does not increment. We get stuck 
on this page of questions/answers forever.


What DOES happen after BACK is that the answers they select get passed 
back to error check (eg if they select a select box to nothing, error 
checking reenters its value into $message) and those values get passed 
back to the display page (eg $_POST[$qname] == $aid) because the 
selected answers change. It's just the db call and category advance 
which get stuck.


Any help will be greatly appreciated - Here's the code:

?php
//Start the session
session_start();
//Error announcements
echo POST:BR /;
print_r($_POST);
echo br /br /;
echo required session:BR /;
var_dump($_SESSION['required_fields']);

echo br /\$ cat: . $cat . br /;
echo \$message: ;
var_dump($message);

//error_reporting(E_ALL);


/* A script to retrieve from database questions and answers,
 * create a multi-page HTML form, error check answers and
 * submit them to the database on a per-user basis.
 * August 2005
 */

//Some basic vars
 if (!isset($cat)) { $cat = 1; }
$error=0;
$SUCCESS=0;


if (!isset($message))
{
$message = array();
}

if (!isset($_SESSION['required_fields']))
{
$_SESSION['required_fields'] = array();
}

if(!sizeof($_POST))
{
include_once(QUESTIONS . 'q.inc');
}

 //error checking

 reset($_SESSION['required_fields']);
  foreach ($_SESSION['required_fields'] as $fieldname)
{
   if (!isset($_POST[$fieldname]) || empty($_POST[$fieldname]))
   {
$message[$fieldname]=1;
   }

 }//error check
  if (!empty($message))
  {   $cat=$_POST['cat'];
  include_once(QUESTIONS . 'q.inc');
  }

//No errors? Store what's been done so far

  if ( ($_POST['action'] == 'process')  (!sizeof($message) ) )
  {
  foreach($_POST as $key=$val)
   {
   //find key/val sets within posts which are both numeric
   if(is_numeric($key)  is_numeric($val))
   {
  $nkey=$key;
  //add keys to the qidlist
  $qidlist[] .= $key;
  //add these values ( q_id, a_id ) to sql statement
  $qanda[] .= ('1' , ' . $nkey . ' , ' . $val . 
');

   }
   //find key/val sets within sub-arrays of $_POST 
which are numeric

   if(is_array($val))
   {
   foreach ($val as $akey=$aval)
   {
   //add these values ( q_id, a_id ) to sql 
statement
   $qanda[] .= ('1' , ' . $key . ' , ' . 
$aval . ');

   var_dump($qanda);
   }
   }
   }


   $qidlist_sql=DELETE FROM $userAnswers WHERE q_id IN ( 
. (implode(,,$qidlist)) . );;


   $q_a_sql=INSERT INTO $userAnswers (u_id, q_id, a_id )
VALUES  . (implode(,,$qanda)) . ;;

 mysql_query($qidlist_sql);


  if($q_a_result = mysql_query($q_a_sql))
{
  unset($_SESSION['required_fields']);
  $cat = $_POST['cat']+1;
  include_once(QUESTIONS . 'q.inc');
}

else
{
echo bA fatal MySQL error occured/b.\n
br /Query:  . $q_a_sql . br /\nError: ( . 
mysql_error();

die;
}

  }
?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Everything works...Unless they hit the back button...

2005-08-03 Thread Jack Jackson

Hi, mark,

snip
Mark Rees wrote:
 Do you want to allow people to go back and change things ?
 If so, write a suitable UPDATE statement
/snip

Thanks, but I think the update function should be built in  -- the sql 
checks whether the userAnswer table contains the q_id the user has just 
entered; if so, it deletes the row containing it and then the second 
query inserts the new values.


   $qidlist_sql=DELETE FROM teresa WHERE q_id IN ( . 
(implode(,,$qidlist)) . );


   $q_a_sql=INSERT INTO teresa (u_id, q_id, a_id )
VALUES  . (implode(,,$qanda)) . ;;


I think there's something wrong with the logic of how I'm handling 
$_POST info and passing it back and forth: here's why: if I close the 
browser and reopen it and  refill the same questions, the answer table 
shows the updated answers. there's something in the logic I am using 
about how I am advancing the $cat and managing the $_POST information. I 
think . But I cannot find it.


Anyone?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Everything works...Unless they hit the back button...

2005-08-03 Thread Jack Jackson

Hi Kristen, there's a misunderstanding:

Kristen G. Thorson wrote:
The code below isn't much help to debug.  Do some checking to figure out 
how far into your IF statement you're getting.  Is the query running?  


Yes it runs successfully

Is it the query you expect?  


Yes it is perfect, and provided this is a new session and we're going 
forward page by page, it properly deletes from and inserts to the db as 
expected


(Step #1 when inserting or creating dynamic
queries that aren't working: print them out to make sure they are what 
you think they are.)  Is the category being incremented?


Yes, absolutely

You say you 
can go back, but you can't go forward.  


Actually no. In a new session, I can start and go forward page by page 
to the end of the questionnaire, advancing each stage perfectly, storing 
all values exactly as I'd expect.


The trouble starts if, during the process, the user hits the BACK 
button. At that point, user can reload the last page of questions, 
displaying the answers they gave. If the user makes changes, those 
changes get error checked but do not become part of the sql query. Also, 
user can not move forwards any more. So it's as the subject says - 
everything works...until they hit the back button, from which point the 
whole thing goes gablooey.


Look at the page source, is the

form action what it should be?


Yes

  Look at the form hidden variables (if

any) are they what you expect?
No. $cat remains what it was BEFORE the user hit the BACK button. 
However the questions dispayed are from the $cat which is in fact $cat-1


??!!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Everything works...Unless they hit the back button...

2005-08-03 Thread Jack Jackson
I've tried playing with the $_SERVER['HTTP_REFERER'] and that's no good 
because it's all coming from the same page - index.php!!


What am I missing. . . ?


Jack Jackson wrote:

Hi Kristen, there's a misunderstanding:

Kristen G. Thorson wrote:

The code below isn't much help to debug.  Do some checking to figure 
out how far into your IF statement you're getting.  Is the query 
running?  



Yes it runs successfully

Is it the query you expect?  



Yes it is perfect, and provided this is a new session and we're going 
forward page by page, it properly deletes from and inserts to the db as 
expected


(Step #1 when inserting or creating dynamic

queries that aren't working: print them out to make sure they are what 
you think they are.)  Is the category being incremented?



Yes, absolutely

You say you can go back, but you can't go forward.  



Actually no. In a new session, I can start and go forward page by page 
to the end of the questionnaire, advancing each stage perfectly, storing 
all values exactly as I'd expect.


The trouble starts if, during the process, the user hits the BACK 
button. At that point, user can reload the last page of questions, 
displaying the answers they gave. If the user makes changes, those 
changes get error checked but do not become part of the sql query. Also, 
user can not move forwards any more. So it's as the subject says - 
everything works...until they hit the back button, from which point the 
whole thing goes gablooey.


Look at the page source, is the


form action what it should be?



Yes

  Look at the form hidden variables (if


any) are they what you expect?


No. $cat remains what it was BEFORE the user hit the BACK button. 
However the questions dispayed are from the $cat which is in fact $cat-1


??!!



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Forming an SQL query

2005-08-02 Thread Jack Jackson

Hi,
Thanks to everyone's help, that multipage monster of a form is now 
working properly (yay!).


One problem I have though is that I stick the answers as each page is 
completed into a table. If the user hits the back button, rather than 
adding a new row to the table I'd rather update it if it's there. That's 
fairly straightforward when it's 1:1 questions to answers:


  $q_a_sql='INSERT INTO $userAnswerTable
  ( q_id, a_id )
  VALUES ' . (implode(,,$qanda))
  . ' on duplicate key UPDATE a_id = VALUES(a_id);';

But when it's 1:n, such as with checkboxes, this neat little plan of 
mine is thwarted.


So if I change the userAnswerTable to three columns, u_id, q_id and 
a_id, is there a way I can do all the 1:1 and 1:n in the manner I wish?


TIA,
JJ

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Forming an SQL query

2005-08-02 Thread Jack Jackson

Ah, I had left out the third column the first time! Thanks.

Now I can insert and not create dupes but for some reason it is not 
updating.



Here's the code:


  if ( ($_POST['action'] == 'process')  (!sizeof($message) ) )
  {
  foreach($_POST as $key=$val)
   {
   //find key/val sets within posts which are both numeric
   if(is_numeric($key)  is_numeric($val))
   {
  $nkey=$key;
  //add these values ( q_id, a_id ) to sql statement
  $qanda[] .= ('1' , ' . $nkey . ' , ' . $val . 
');

   }
   //find key/val sets within sub-arrays of $_POST 
which are numeric

   if(is_array($val))
   {
   foreach ($val as $akey=$aval)
   {
   //add these values ( q_id, a_id ) to sql 
statement
   $qanda[] .= ('1' , ' . $key . ' , ' . 
$aval . ');

   }
   }
   }

$q_a_sql=INSERT INTO . $userTable . (u_id, q_id, a_id )
  VALUES  . (implode(,,$qanda)) . on duplicate key 
UPDATE a_id = VALUES(a_id);;


  if($q_a_result = mysql_query($q_a_sql))
{
  unset($_SESSION['required_fields']);
  $cat = $_POST['cat']+1;
  include_once(QUESTIONS . 'q.inc');
}


?


Kristen G. Thorson wrote:
How is it your plan thwarted?  It looks fine to me, but maybe I'm 
missing something.  The only thing I can think is that you're not 
defining your table keys correctly to correctly use ON DUPLICATE KEY.  
Do you have a key defined for all three columns *together*?


mysql create table user_answers (u_id int(11) not null, q_id int(11) 
not null, a_id int(11) not null, unique( u_id, q_id, a_id ) );

Query OK 0 rows affected (0.22 sec)

mysql insert into user_answers (u_id,q_id,a_id) values 
(1,1,1),(1,1,2),(1,2,1),(1,1,1) on duplicate key update a_id=values(a_id);

Query OK, 5 rows affected (0.01 sec)
Records: 4  Duplicates: 1  Warnings: 0

mysqlselect * from user_answers;
+--+--+--+
| u_id | q_id | a_id |
+--+--+--+
|1 |1 |1 |
|1 |1 |2 |
|1 |1 |3 |
+--+--+--+
3 rows in set (0.00 sec)



So, three different answers for the same user  same question.  The one 
duplicate did not cause an error because of the ON DUPLICATE KEY.  This 
looks like it's what you're trying to do, so then what's your error?




kgt




Jack Jackson wrote:


Hi,
Thanks to everyone's help, that multipage monster of a form is now 
working properly (yay!).


One problem I have though is that I stick the answers as each page is 
completed into a table. If the user hits the back button, rather than 
adding a new row to the table I'd rather update it if it's there. 
That's fairly straightforward when it's 1:1 questions to answers:


  $q_a_sql='INSERT INTO $userAnswerTable
  ( q_id, a_id )
  VALUES ' . (implode(,,$qanda))
  . ' on duplicate key UPDATE a_id = VALUES(a_id);';

But when it's 1:n, such as with checkboxes, this neat little plan of 
mine is thwarted.


So if I change the userAnswerTable to three columns, u_id, q_id and 
a_id, is there a way I can do all the 1:1 and 1:n in the manner I wish?


TIA,
JJ







--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: error checking a null array

2005-08-01 Thread Jack Jackson


g.gill wrote:
From what I understand the simplest solution here would be to check to see 
if you have $_POST['cb'] in the first place.  That would indicate if 
checkbox was selected or not.  After, you have posted the form just do the 
following test.


$check_box_exits = ((isset($_POST['cb']))? true:false);



That helped, sonu, thank you. The problem now is that, how can I pass 
through $_POST the names of each specific checkbox, whether filled in or 
not, and then parse each to see if they have any answer? I need to do 
that or else I can only tell the ones which *have* been filled in but 
not those which have not.


Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: error checking a null array

2005-08-01 Thread Jack Jackson


Jochem Maas wrote:
snip


wtf are you smoking Jack? every checkbox that was checked will exist in the
$_POST array set with the value you gave it (I alway set a chekcboxes 
value to 1
because the values mere existance in the submitted data indicates it's 
chevckbox
 was checked), if a checkbox does not exist in the $_POST array it 
wasn't checked!!!


Oh, how I wish I were smoking something :) !

imagine you have 10 checkboxes named 'cb1' thru 'cb10' each with a value 
of '1',
upon submitting the form they are in, your script sees the following in 
the $_POST

array...

$_POST = array('cb1' = '1', 'cb9' = '1', 'cb10' = '1');

which tells you 3 checkboxes were checked... namely 'cb1', 'cb9' and 'cb10'
now how hard is it to determine which we're not checked?



Well, for me, it is - because I don't know the names of the other check 
boxes which were not checked because they were dynamically created, and 
I don't have the knowledge sufficient to pass the NAMES of all 
checkboxes through to $_POST so that I can search through and see which 
have been answered and which ones not.





maybe I'm not seeing the problem but I get the impression that you are
over complicating things regarding checkbox.


As always this is hugely possible.


JJ

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] error checking woes

2005-08-01 Thread Jack Jackson



Kristen G. Thorson wrote:

Thanks for the  ==  !

But I had set $message global within the buld-checkbox function, so that 
part of it does work. . . .







Jack,

Read below:



Jack Jackson wrote:


Hi,
Now that the drop down is working properly (thanks!!), I am trying to 
validate, and having LOTS of trouble. After being ceaselessly derided 
last night on an irc channel for my dimwitedness, I am still not any 
closer.


The code which works is this:

function GetQuestionsDropdown($cat){
//first get all the questions

$sql = SELECT * FROM questions WHERE questions.q_cat=$cat AND 
questions.q_style=1;


$result = mysql_query($sql);
//now one-by-one go through the questions
while($row = mysql_fetch_assoc($result)) {
   //if the form has been submitted, and the question 
unanswered

//highlight this whole question and answer block in red.
if ($message[$row['q_name']] == 1){






How does this funtion have access to $message?  You need to a) make it 
global or b) pass it in.




echo div class='error';
}
   //Make a question set div wrapper
echo div class='q_set'\n;
//State the question
echo div class='question';
echo $row['q_text'] . /div;
echo \n\n;
echo  div class='answer';
echo \n;
   //Create the dropdown for the answers
echo '  select name=' . $row['q_name'] . '';
echo \n;
   //get all of the answers for THIS question
$ans_sql = select * from answers where answers.q_id= . 
$row['q_id'];

$ans_result = mysql_query($ans_sql);

echo option value=\\Select from this list/option\n;
while($ans_row = mysql_fetch_assoc($ans_result)) {
   //list the answers for THIS question
echo option ;
echo value=\ . $ans_row['a_id'] . \;

if  ($row['q_name'] == $ans_row['a_id']) {
echo  selected;
}

echo  . $ans_row['a_answer'] . /option;
echo \n;
}
echo '  /select' . \n . ' /div' . \n;
echo /div!--q_set--\n\n;
//If there *was* an error div, close it
if (sizeof($message[$row['q_name']])){
echo /div!--/error--;
}
}
}//function GetQuestionsDropdown


NOW I have to validate after it's submitted. I am trying to look and 
see, if $_POST[$row['q_name']] is empty then make message of the same 
name = 1, so if


   if(empty($_POST['partners'])) {
   $message['partners'] = '1'
}

Then when I restate the dropdown function, and it shows the questions 
again,  those error checking things I built in will

a) show a div class=error around questions with a message
b) pre-select the previously selected answers (because I have put 
in the thing in the dropdown which says


 if ($row['q_name'] == $ans_row['a_id']) { echo  selected;}


The validate code I was trying, the subject of such howling on IRC 
(and I know it doesn't work, but not why) was:


function ValidatePost($cat){
//first get the q_names
$sql = SELECT * FROM questions WHERE q_cat=$cat;
$result = mysql_query($sql);

//go through the question set
while($row = mysql_fetch_assoc($result)) {
  if(empty($_POST[$row['q_name']])){
  $message[$row['q_name']] == 1;






You want $message = 1 here.  = = is for comparison.

You're setting $message inside a function.  This means it doesn't exist 
outside this scope!




  }
}
}//function ValidatePost

Can anyone tell me what I am doing wrong?

Thanks!
JJ





Hope this helps you get somewhere,

kgt




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] returning info. from a form selection

2005-08-01 Thread Jack Jackson
It'd have to be in the form of a form and you'd need to add values to 
the options, wrap it inside form tags, specify a method like $_POST or 
$_GET, error check and then send.





Bruce Gilbert wrote:

can anyone give me an idea on how to return info. from a forl pulldown menu

eg:

select class=textbox 
name=loan_process
  option value= 
  selected=selectedPurchase/option
  option 
  value=Construct Home/option

  option
/select

and return that to an email address.


thanks





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: error checking a null array

2005-08-01 Thread Jack Jackson

AAarg.


Okay, thanks to all of you I've decided that any field name I need to 
see will be sent to $_SESSION['required_fields'] and basta.


Then after the submit button is pressed, I am doing this:



reset($_SESSION['required_fields']);
  foreach ($_SESSION['required_fields'] as $fieldname)
{
   if (!isset($_POST[$fieldname]) || empty($_POST[$fieldname]))
{
$message[$fieldname]=1;
include_once(QUESTIONS . 'q.inc');
}
}//error check



And this is *almost* working: it seems to crap out after the first loop 
through the $_SESSION['required_field'] array.


The array says:

Array ( [required_fields] = Array ( [0] = 1 [1] = 2 [2] = 3 [3] = 4 
[4] = 1 [5] = 2 [6] = 3 [7] = 4 [8] = 1 [9] = 2 [10] = 3 [11] = 
4 ) )


$_POST says:

Array ( [action] = [process]process [1] = [2] = 68 [3] = [4] = )

So you see, there's an answer specified for the value of question [2].

But $messages says only:

$message: array(1) { [1]=  int(1) }


Why is it dying after the first loop through?

Thanks in advance

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: error checking a null array

2005-08-01 Thread Jack Jackson

I can only swear this to the entire list:

Before I come here for help, each time, I echo and var_dump and print_r 
until, yes, I need a doctor.


So by the time I come here, it's not laziness or lack of looking in the 
manual, it's head-swirling confusion infused with incompetence and a 
complete lack of programming experience at any time before April of this 
year which leads me to come back again and again with relatively foolish 
questions.



My problem before, for example: In my error check function, I placed the 
include file (to return to the form) *within* the foreach loop, and then 
I wondered why it only ran through once.


D'oh.



Jochem Maas wrote:

Jack Jackson wrote:


AAarg.


Okay, thanks to all of you I've decided that any field name I need to 
see will be sent to $_SESSION['required_fields'] and basta.


Then after the submit button is pressed, I am doing this:



reset($_SESSION['required_fields']);



reset is not required when using foreach. and given that you have probably
not looped that item


  foreach ($_SESSION['required_fields'] as $fieldname)
{
   if (!isset($_POST[$fieldname]) || empty($_POST[$fieldname]))
{
$message[$fieldname]=1;
include_once(QUESTIONS . 'q.inc');
}
}//error check




you may be getting into trouble because of php's typecasting - try using
fielnames that are strings that do not auto cast to integers (which can be
used as array keys for indexed arrays) e.g. cb1 instead of 1



And this is *almost* working: it seems to crap out after the first 
loop through the $_SESSION['required_field'] array.


The array says:

Array ( [required_fields] = Array ( [0] = 1 [1] = 2 [2] = 3 [3] = 
4 [4] = 1 [5] = 2 [6] = 3 [7] = 4 [8] = 1 [9] = 2 [10] = 3 [11] 
= 4 ) )


$_POST says:

Array ( [action] = [process]process [1] = [2] = 68 [3] = [4] = )



that does not look like valid output from var_dump() neither does the 
output you

show for $_SESSION['required_field'].



So you see, there's an answer specified for the value of question [2].

But $messages says only:

$message: array(1) { [1]=  int(1) }


Why is it dying after the first loop through?



is it? (use print_r() or var_dump() inside the loop to see what is 
happening)


NOT SO SUBTLE HINT: USE echo, print_r() and var_dump() until either you 
fingers or
your eyes start to bleed ;-) if you still haven't figured it out by then 
it's

time to see a doctor -












Thanks in advance







--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php-mySQL insert problem

2005-08-01 Thread Jack Scott
Try this:
$insertQuery = Insert into TABLE 
(
col_one,
col_two
)values (
' . $this - firstName . ',
' . $this- lastName . '
);
$db = new DB;
$res = $db-query($insertQuery);
if(DB::isError($res)){
exit(Insert query failed: .__FUNCTION__.() brin file
.__FILE__.bron line .__LINE__.br.$res-getDebugInfo());
}else{
return;
}

you need to have quotes arround your varchar items and you should also
specify which column you want the values to go into.
It is also good practice to check if there is an error and try to get
the most information available.

On Tue, 2005-08-02 at 00:44 +0200, Adi Zebic wrote:
 $insertQuery = Insert into TABLE values (.$this -
 firstName.,.$this 
 - lastName));
 $db = new DB;
 $db - query($insertQuery);

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: SOLVED - [PHP] php-mySQL insert problem

2005-08-01 Thread Jack Scott
no prob ;-)

On Tue, 2005-08-02 at 02:27 +0200, Adi Zebic wrote:
 Jack Scott a écrit :
  Try this:
  $insertQuery = Insert into TABLE 
  (
  col_one,
  col_two
  )values (
  ' . $this - firstName . ',
  ' . $this- lastName . '
  );
  $db = new DB;
  $res = $db-query($insertQuery);
  if(DB::isError($res)){
  exit(Insert query failed: .__FUNCTION__.() brin file
  .__FILE__.bron line .__LINE__.br.$res-getDebugInfo());
  }else{
  return;
  }
  
  you need to have quotes arround your varchar items and you should also
  specify which column you want the values to go into.
 
 Yess! That's the right one :-)
 
  It is also good practice to check if there is an error and try to get
  the most information available.
 
 DB class do the right thing with try/catch.
 
 THANK YOU VERY VERY MUCH Jack Scott!
 
 ADI
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] error checking woes- SOLVED

2005-07-31 Thread Jack Jackson
I did the smart thing last night: nothing. I read some PHP books and 
then realized that the answer to my error checking was a lot less 
complex, once again, than I had initially suspected. I finally ended up 
with:



 //error checking
foreach($_POST as $qname=$value) {
if(empty($value)){
$message[$qname]=1;
}
}


I cannot believe what I started with and what I ended up with.

Thanks as usual for the help!!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] error checking a null array

2005-07-31 Thread Jack Jackson

hi,
I have checkboxes beging dynamically generated. to seperate tasks in 
error checking I have added he arrays not just to $_POST but to 
$_POST[cb]  so names (derived from question numbers) are for example:


$_POST[cb][7]

A dump of $_POST would therefore include something like

[cb]=  array(1) { [7]=  array(1) { [0]=  string(3) 124 } }

 So I did this:

//error checking for checkboxes 
foreach ($cb as $cbkey = $cbvalue)
   {
  foreach($cbvalue as $cbkey2=$cb_answers)
  {
 if( !array_key_exists($_POST[$cbkey], $cb));
 {
 $message[$cbkey]=1;
 }
   }
   }

This almost works. The problem is that if someone doesn't check a 
checkbox, NOTHING related to the checkbox gets sent to $_POST; if I 
insert a hidden value of something, then that hidden value gets passed 
whether the user inputs something or not, since I need an entirely 
server-side solution. Is there a way to send something to tell the error 
checker whether for example $_POST[cb][7] is empty or null, so I can set 
the error message to one if it's empty?


Dump of $_POST with no checkboxes checked
$_POST:
array(4) { [action]= string(7) process [cat]= string(1) 2 
[rs]= array(3) { [5]= string(0)  [6]= string(0)  [9]= 
string(0)  } [b]= string(8) Continue }


Dump of $_POST with checkboxes checked

array(5) { [action]=  string(7) process [cat]=  string(1) 2 
[cb]=  array(2) { [7]=  array(5) { [0]=  string(1) 3 [1]= 
string(3) 124 [2]=  string(3) 125 [3]=  string(3) 127 [4]= 
string(3) 131 } [8]=  array(3) { [0]=  string(3) 141 [1]= 
string(3) 145 [2]=  string(1) 4 } } [rs]=  array(3) { [5]= 
string(0)  [6]=  string(0)  [9]=  string(0)  } [b]= 
string(8) Continue }



Thanks so much In advance

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: error checking a null array

2005-07-31 Thread Jack Jackson



David Robley wrote:

Jack Jackson wrote:



hi,
I have checkboxes beging dynamically generated. to seperate tasks in
error checking I have added he arrays not just to $_POST but to
$_POST[cb]  so names (derived from question numbers) are for example:

$_POST[cb][7]

A dump of $_POST would therefore include something like

[cb]=  array(1) { [7]=  array(1) { [0]=  string(3) 124 } }

 So I did this:

//error checking for checkboxes
foreach ($cb as $cbkey = $cbvalue)
   {
  foreach($cbvalue as $cbkey2=$cb_answers)
  {
 if( !array_key_exists($_POST[$cbkey], $cb));
 {
 $message[$cbkey]=1;
 }
   }
   }

This almost works. The problem is that if someone doesn't check a
checkbox, NOTHING related to the checkbox gets sent to $_POST; if I
insert a hidden value of something, then that hidden value gets passed
whether the user inputs something or not, since I need an entirely
server-side solution. Is there a way to send something to tell the error
checker whether for example $_POST[cb][7] is empty or null, so I can set
the error message to one if it's empty?



I think you might find empty() and isset() fairly useful here.



Cheers


I would have thought so too, but empty doesn't seem to work if it's not 
there at all, (I guess it figures, how can it be empty if it isn't 
there) and isset doesn't work if the array is there but null. or 
something like that. IN any case I've yet to get them working using 
either. I probably should have said that!


Thanks in advance

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] error checking woes

2005-07-30 Thread Jack Jackson

Hi,
Now that the drop down is working properly (thanks!!), I am trying to 
validate, and having LOTS of trouble. After being ceaselessly derided 
last night on an irc channel for my dimwitedness, I am still not any closer.


The code which works is this:

function GetQuestionsDropdown($cat){
//first get all the questions

$sql = SELECT * FROM questions WHERE questions.q_cat=$cat AND 
questions.q_style=1;


$result = mysql_query($sql);
//now one-by-one go through the questions
while($row = mysql_fetch_assoc($result)) {

//if the form has been submitted, and the question unanswered
//highlight this whole question and answer block in red.
if ($message[$row['q_name']] == 1){
echo div class='error';
}

//Make a question set div wrapper
echo div class='q_set'\n;
//State the question
echo div class='question';
echo $row['q_text'] . /div;
echo \n\n;
echo  div class='answer';
echo \n;

//Create the dropdown for the answers
echo '  select name=' . $row['q_name'] . '';
echo \n;

//get all of the answers for THIS question
$ans_sql = select * from answers where answers.q_id= . $row['q_id'];
$ans_result = mysql_query($ans_sql);

echo option value=\\Select from this list/option\n;
while($ans_row = mysql_fetch_assoc($ans_result)) {

//list the answers for THIS question
echo option ;
echo value=\ . $ans_row['a_id'] . \;

if  ($row['q_name'] == $ans_row['a_id']) {
echo  selected;
}

echo  . $ans_row['a_answer'] . /option;
echo \n;
}
echo '  /select' . \n . ' /div' . \n;
echo /div!--q_set--\n\n;
//If there *was* an error div, close it
if (sizeof($message[$row['q_name']])){
echo /div!--/error--;
}
}
}//function GetQuestionsDropdown


NOW I have to validate after it's submitted. I am trying to look and 
see, if $_POST[$row['q_name']] is empty then make message of the same 
name = 1, so if


   if(empty($_POST['partners'])) {
   $message['partners'] = '1'
}

Then when I restate the dropdown function, and it shows the questions 
again,  those error checking things I built in will

a) show a div class=error around questions with a message
	b) pre-select the previously selected answers (because I have put in 
the thing in the dropdown which says


 if ($row['q_name'] == $ans_row['a_id']) { echo  selected;}


The validate code I was trying, the subject of such howling on IRC (and 
I know it doesn't work, but not why) was:


function ValidatePost($cat){
//first get the q_names
$sql = SELECT * FROM questions WHERE q_cat=$cat;
$result = mysql_query($sql);

//go through the question set
while($row = mysql_fetch_assoc($result)) {

  if(empty($_POST[$row['q_name']])){

  $message[$row['q_name']] == 1;
  }
}
}//function ValidatePost

Can anyone tell me what I am doing wrong?

Thanks!
JJ

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] error checking woes

2005-07-30 Thread Jack Jackson


Okay, last attempt before I hit my head against wall. I thought perhaps 
to add the error check to the dropdown function itself:




function GetQuestionsDropdown($cat){
//first get all the questions

$sql = SELECT * FROM questions WHERE questions.q_cat=$cat AND 
questions.q_style=1;


$result = mysql_query($sql);
//now one-by-one go through the questions
while($row = mysql_fetch_assoc($result)) {

//if the form has been submitted, and the question unanswered
//highlight this whole question and answer block in red.
if ($message[$row['q_name']] == 1){
echo div class='error';
}

//Make a question set div wrapper
echo div class='q_set'\n;
//State the question
echo div class='question';
echo $row['q_text'] . /div;
echo \n\n;
echo  div class='answer';
echo \n;

//Create the dropdown for the answers
echo '  select name=' . $row['q_name'] . '';
echo \n;

//get all of the answers for THIS question
$ans_sql = select * from answers where answers.q_id= . $row['q_id'];
$ans_result = mysql_query($ans_sql);

echo option value=\\Select from this list/option\n;
while($ans_row = mysql_fetch_assoc($ans_result)) {

//list the answers for THIS question
echo option ;
echo value=\ . $ans_row['a_id'] . \;

if  ($row['q_name'] == $ans_row['a_id']) {
echo  selected;
}

echo  . $ans_row['a_answer'] . /option;
echo \n;
}
echo '  /select' . \n . ' /div' . \n;
echo /div!--q_set--\n\n;
//If there *was* an error div, close it
if (sizeof($message[$row['q_name']])){
echo /div!--/error--;
}
//error checking
if ( !strcmp($action,'process') ) {
  if(empty($_POST[$row['q_name']])){
  $message[$row['q_name']] == 1;
  }
}


}
}//function GetQuestionsDropdown




it didn't work either.










Jack Jackson wrote:

Hi,
Now that the drop down is working properly (thanks!!), I am trying to 
validate, and having LOTS of trouble. After being ceaselessly derided 
last night on an irc channel for my dimwitedness, I am still not any 
closer.


The code which works is this:

function GetQuestionsDropdown($cat){
//first get all the questions

$sql = SELECT * FROM questions WHERE questions.q_cat=$cat AND 
questions.q_style=1;


$result = mysql_query($sql);
//now one-by-one go through the questions
while($row = mysql_fetch_assoc($result)) {
   
//if the form has been submitted, and the question unanswered

//highlight this whole question and answer block in red.
if ($message[$row['q_name']] == 1){
echo div class='error';
}
   
//Make a question set div wrapper

echo div class='q_set'\n;
//State the question
echo div class='question';
echo $row['q_text'] . /div;
echo \n\n;
echo  div class='answer';
echo \n;
   
//Create the dropdown for the answers

echo '  select name=' . $row['q_name'] . '';
echo \n;
   
//get all of the answers for THIS question

$ans_sql = select * from answers where answers.q_id= . $row['q_id'];
$ans_result = mysql_query($ans_sql);

echo option value=\\Select from this list/option\n;
while($ans_row = mysql_fetch_assoc($ans_result)) {
   
//list the answers for THIS question

echo option ;
echo value=\ . $ans_row['a_id'] . \;

if  ($row['q_name'] == $ans_row['a_id']) {
echo  selected;
}

echo  . $ans_row['a_answer'] . /option;
echo \n;
}
echo '  /select' . \n . ' /div' . \n;
echo /div!--q_set--\n\n;
//If there *was* an error div, close it
if (sizeof($message[$row['q_name']])){
echo /div!--/error--;
}
}
}//function GetQuestionsDropdown


NOW I have to validate after it's submitted. I am trying to look and 
see, if $_POST[$row['q_name']] is empty then make message of the same 
name = 1, so if


   if(empty($_POST['partners'])) {
   $message['partners'] = '1'
}

Then when I restate the dropdown function, and it shows the questions 
again,  those error checking things I built in will

a) show a div class=error around questions with a message
b) pre-select the previously selected answers (because I have put

Re: [PHP] Dropdown Building Function

2005-07-29 Thread Jack Jackson
Hi, can anyone even point me in a *direction*? I suppose this is the 
most complex thing I've ever tried to do and I have been at it for tens 
of hours and am still completely baffled.



Jack Jackson wrote:

Hi,
because that last topic on multipage forms was so exciting, I decided to 
database the questions as well. I wonder if anyone can help me with a 
function to pull rows into dropdown boxes.


It's a 1:n relationship between questions and answers, and I have a 
table of questions


q_id
q_name
q_text
q_style //dropdown, radio, checkboxes
q_cat //question category

and a table full of answers

a_id
q_id
a_answer


When I do

$fields = 'SELECT *';
$from = 'FROM questions,answers';
$sort = ORDER BY questions.q_cat;
$where = WHERE answers.q_id=questions.q_id;

// construct the sql query:
$sql = $fields $from $where $sort;

// Run SQL query 1
if (!($result = mysql_query($sql))) {
echo Could not connect to the database ($sql) . mysql_error();
}

while ($row = mysql_fetch_assoc($result)) {


I need to loop through the results and make a dropdown list from them, 
taking the question name as the select name, and then making each answer 
id and answer text the makings of an option ros.


Based on a problem a while ago which was similar but different, someone 
here actually made me a function *similar* to what I need to do now, 
This one acts different and I just cannot adapt the old one, because I 
still get confused at this level.


I think it wants to be something like (and note that part of the return 
is the code to react to error checking results):


$dropdown[] = 'option ?php if (' . $q_name . ' == ' . $a_id . ') 
echo selected ; ? value=\'' . $a_id . '\'' . $a_answer . '/option';


etc for all $a_answer(s)...
and then

return '?php if (sizeof($message[\'' . $q_name . '\'])){ echo div 
class='error'; } ?

div class=\'row\'
select class=\'answer\' name=\'' . $q_name . '\'
option value=\'\'Select from this list/option'
 join('',$dropdown)
 . '/select/div'
 . '?php if (sizeof($message[\''. $q_name '\'])){ echo 
/div!--/error--; } ?';



Can anyone point me at the right direction?

Thanks!!

JJ



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Dropdown Building Function

2005-07-29 Thread Jack Jackson

Hi, Jay,
I see perhaps I *was* thinking too complex. However this is *just* a bit 
  off:


Jay Blanchard wrote:

[snip]
Hi, can anyone even point me in a *direction*? I suppose this is the 
most complex thing I've ever tried to do and I have been at it for tens 
of hours and am still completely baffled.



Jack Jackson wrote:


Hi,
because that last topic on multipage forms was so exciting, I decided


to 

database the questions as well. I wonder if anyone can help me with a 
function to pull rows into dropdown boxes.


It's a 1:n relationship between questions and answers, and I have a 
table of questions


q_id
q_name
q_text
q_style //dropdown, radio, checkboxes
q_cat //question category

and a table full of answers

a_id
q_id
a_answer


When I do

   $fields = 'SELECT *';
   $from = 'FROM questions,answers';
   $sort = ORDER BY questions.q_cat;
   $where = WHERE answers.q_id=questions.q_id;

// construct the sql query:
$sql = $fields $from $where $sort;

// Run SQL query 1
if (!($result = mysql_query($sql))) {
echo Could not connect to the database ($sql) . mysql_error();
}

while ($row = mysql_fetch_assoc($result)) {
   


I need to loop through the results and make a dropdown list from them,




taking the question name as the select name, and then making each


answer 


id and answer text the makings of an option ros.

Based on a problem a while ago which was similar but different,


someone 

here actually made me a function *similar* to what I need to do now, 
This one acts different and I just cannot adapt the old one, because I




still get confused at this level.

I think it wants to be something like (and note that part of the


return 


is the code to react to error checking results):

$dropdown[] = 'option ?php if (' . $q_name . ' == ' . $a_id . ') 
echo selected ; ? value=\'' . $a_id . '\'' . $a_answer .


'/option';


   etc for all $a_answer(s)...
   and then
   
return '?php if (sizeof($message[\'' . $q_name . '\'])){ echo div 
class='error'; } ?

   div class=\'row\'
   select class=\'answer\' name=\'' . $q_name . '\'
   option value=\'\'Select from this list/option'
join('',$dropdown)
. '/select/div'
. '?php if (sizeof($message[\''. $q_name '\'])){ echo 
/div!--/error--; } ?';
   


Can anyone point me at the right direction?

Thanks!!

JJ



[/snip]


It seems that you have over-complicated the issue, let me boil it down a
little;

$sql = select answer from table ;
if(!($result = mysql_query($sql, $connection))){
   echo mysql_error() . \n;
   exit();
}

echo select name=\answers\\n;
while($row = mysql_fetch_array($result)){
echo option name=\. $row['answer'] . \;
echo $row['answer'];
echo /option\n;

}
echo /select\n;

Your out put will look like this;

select name=answers
option name=answer1answer1/option
option name=answer2answer2/option
option name=answer3answer3/option
/select

Is this what you're after?




Very close to it, thank you! However this completes the gap: I am still 
not sure if my syntax is right:



$sql = 'SELECT *
FROM questions,answers
WHERE answers.q_id=questions.q_id
ORDER BY questions.q_cat,questions.q_id,answers.q_id';

if(!($result = mysql_query($sql, $connection))){
echo mysql_error() . \n;
exit();
 }

 /*each question has at least one answer, usually three to six
  *I need to give the select the name of $q_name
  *and dynamically loop through until all the question/answer
  *sets have their own dropdown
  */


 echo select name=\' . $q_name . \'\n;
 while($row = mysql_fetch_array($result)){
echo option name=\. $row['a_id'] . \;
echo ?php if . \$$q_name .  ==  . $a_id . echo \selected \ 
?\n;
echo $row['$a_answer'];
echo /option\n;

 }
 echo /select\n;

Then hopefully my output would look like
 select name=question_name
 option ?php if $question_name == 1 echo selected  ? 
value=1Answer One/option


 select name=question_name
 option ?php if $question_name == 2 echo selected  ? 
value=2Answer Two/option


 select name=question_name
 option ?php if $question_name == 1 echo selected  ? 
value=3Answer Two/option

 /select





TIA!!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Dropdown Building Function

2005-07-29 Thread Jack Jackson


Kristen,

Thank you so much this is precisely what I was trying to accomplish. 
However I was also trying to learn how to do it with those arrays you 
mentioned which I figure will help me emerge from total newbieness.


To date, I hope the list has seen I've progressed from absolutely *no* 
programming experience whatever to the point where I feel comfortable 
saying I am a newbie programmer (as opposed to a clueless one).


But Multidimensional arrays still baffle me and I believe that certain 
aspects of them work by magic!


I hope that people here will help me figure out both approaches. And 
thank you so much for the code here and the fix, which even I can follow!


JJ



Kristen G. Thorson wrote:
I'm not 100% sure where you're saying you're stuck, but I think you're 
trying to do with one query what you will probably find is best to do 
with several.  Hopefully the following will help some:



//first get all the questions
$sql = select * from questions;
$result = mysql_query( $sql );

//now one-by-one go through the questions
while( $row = mysql_fetch_row( $result ) {

   //create the drop down box for THIS question
   echo 'select name='.$row['question_text'].'';

   //get all of the answers for THIS question
   $ans_sql = select * from answers where 
question_id=.$row['question_id'];

   $ans_result = mysql_query( $ans_sql );
   while( $ans_row = mysql_fetch_row( $ans_result ) ) {

  //list the answers for THIS question
  echo 'option 
value='.$ans_row['answer_id'].''.$ans_row['answer_text'].'/option';

   }
   echo '/select';
}

outputs:
select name=question1
option value=1answer 1/option
option value=2answer 2/option
option value=3answer 3/option

select name=question2
option value=1answer 1/option
option value=2answer 2/option
option value=3answer 3/option
option value=4answer 4/option
option value=5answer 5/option



It requires numerous DB calls, but I believe in most cases, it's still 
better than what you'd have to do otherwise (create some arrays and do 
some sorting, etc.).  That is, if I've understood what you need ;)





kgt




Jack Jackson wrote:

Hi, can anyone even point me in a *direction*? I suppose this is the 
most complex thing I've ever tried to do and I have been at it for 
tens of hours and am still completely baffled.



Jack Jackson wrote:


Hi,
because that last topic on multipage forms was so exciting, I decided 
to database the questions as well. I wonder if anyone can help me 
with a function to pull rows into dropdown boxes.


It's a 1:n relationship between questions and answers, and I have a 
table of questions


q_id
q_name
q_text
q_style //dropdown, radio, checkboxes
q_cat //question category

and a table full of answers

a_id
q_id
a_answer


When I do

$fields = 'SELECT *';
$from = 'FROM questions,answers';
$sort = ORDER BY questions.q_cat;
$where = WHERE answers.q_id=questions.q_id;

// construct the sql query:
$sql = $fields $from $where $sort;

// Run SQL query 1
if (!($result = mysql_query($sql))) {
echo Could not connect to the database ($sql) . mysql_error();
}

while ($row = mysql_fetch_assoc($result)) {
   I need to loop through the results and make a dropdown list from 
them, taking the question name as the select name, and then making 
each answer id and answer text the makings of an option ros.


Based on a problem a while ago which was similar but different, 
someone here actually made me a function *similar* to what I need to 
do now, This one acts different and I just cannot adapt the old one, 
because I still get confused at this level.


I think it wants to be something like (and note that part of the 
return is the code to react to error checking results):


$dropdown[] = 'option ?php if (' . $q_name . ' == ' . $a_id . ') 
echo selected ; ? value=\'' . $a_id . '\'' . $a_answer . 
'/option';


etc for all $a_answer(s)...
and then
return '?php if (sizeof($message[\'' . $q_name . '\'])){ echo 
div class='error'; } ?

div class=\'row\'
select class=\'answer\' name=\'' . $q_name . '\'
option value=\'\'Select from this list/option'
 join('',$dropdown)
 . '/select/div'
 . '?php if (sizeof($message[\''. $q_name '\'])){ echo 
/div!--/error--; } ?';

   Can anyone point me at the right direction?

Thanks!!

JJ









--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Dropdown Building Function

2005-07-29 Thread Jack Jackson

And of course, I am finding that this way of yours is the easiest!!

Thanks, again, Kristen


JJ
Kristen G. Thorson wrote:
I'm not 100% sure where you're saying you're stuck, but I think you're 
trying to do with one query what you will probably find is best to do 
with several.  Hopefully the following will help some:



//first get all the questions
$sql = select * from questions;
$result = mysql_query( $sql );

//now one-by-one go through the questions
while( $row = mysql_fetch_row( $result ) {

   //create the drop down box for THIS question
   echo 'select name='.$row['question_text'].'';

   //get all of the answers for THIS question
   $ans_sql = select * from answers where 
question_id=.$row['question_id'];

   $ans_result = mysql_query( $ans_sql );
   while( $ans_row = mysql_fetch_row( $ans_result ) ) {

  //list the answers for THIS question
  echo 'option 
value='.$ans_row['answer_id'].''.$ans_row['answer_text'].'/option';

   }
   echo '/select';
}

outputs:
select name=question1
option value=1answer 1/option
option value=2answer 2/option
option value=3answer 3/option

select name=question2
option value=1answer 1/option
option value=2answer 2/option
option value=3answer 3/option
option value=4answer 4/option
option value=5answer 5/option



It requires numerous DB calls, but I believe in most cases, it's still 
better than what you'd have to do otherwise (create some arrays and do 
some sorting, etc.).  That is, if I've understood what you need ;)





kgt




Jack Jackson wrote:

Hi, can anyone even point me in a *direction*? I suppose this is the 
most complex thing I've ever tried to do and I have been at it for 
tens of hours and am still completely baffled.



Jack Jackson wrote:


Hi,
because that last topic on multipage forms was so exciting, I decided 
to database the questions as well. I wonder if anyone can help me 
with a function to pull rows into dropdown boxes.


It's a 1:n relationship between questions and answers, and I have a 
table of questions


q_id
q_name
q_text
q_style //dropdown, radio, checkboxes
q_cat //question category

and a table full of answers

a_id
q_id
a_answer


When I do

$fields = 'SELECT *';
$from = 'FROM questions,answers';
$sort = ORDER BY questions.q_cat;
$where = WHERE answers.q_id=questions.q_id;

// construct the sql query:
$sql = $fields $from $where $sort;

// Run SQL query 1
if (!($result = mysql_query($sql))) {
echo Could not connect to the database ($sql) . mysql_error();
}

while ($row = mysql_fetch_assoc($result)) {
   I need to loop through the results and make a dropdown list from 
them, taking the question name as the select name, and then making 
each answer id and answer text the makings of an option ros.


Based on a problem a while ago which was similar but different, 
someone here actually made me a function *similar* to what I need to 
do now, This one acts different and I just cannot adapt the old one, 
because I still get confused at this level.


I think it wants to be something like (and note that part of the 
return is the code to react to error checking results):


$dropdown[] = 'option ?php if (' . $q_name . ' == ' . $a_id . ') 
echo selected ; ? value=\'' . $a_id . '\'' . $a_answer . 
'/option';


etc for all $a_answer(s)...
and then
return '?php if (sizeof($message[\'' . $q_name . '\'])){ echo 
div class='error'; } ?

div class=\'row\'
select class=\'answer\' name=\'' . $q_name . '\'
option value=\'\'Select from this list/option'
 join('',$dropdown)
 . '/select/div'
 . '?php if (sizeof($message[\''. $q_name '\'])){ echo 
/div!--/error--; } ?';

   Can anyone point me at the right direction?

Thanks!!

JJ









--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Dropdown Building Function

2005-07-29 Thread Jack Jackson

Aaron,
Thanks for showing me this it is very cool indeed.

However maybe I am being dumb and obdurate but what I am really trying 
to do is build some of these things myself (with, thankfully, help) so 
that I understand enough that when I see a great tool like yours I'll 
actually appreciate what it's doing for me. I can see that your tool is 
doing everything in one line, and I think its really great. I just am 
such a beginner that I think tools like that would encourage me to 
*never* get above this level I'm at now.


I got the questions and answers thing working, starting with Kristen's 
two-query code and moving from there. I would like to come back to see 
how it can be done with one query and one function, but at this point my 
eyes are so bleary I'm grateful for the fact that I can now focus on 
getting the form to process!


Thanks again

JJ

Aaron Greenspan wrote:

Jay,

This is why I think frameworks are helpful Here's how I'd do it with 
Lampshade in one line of code with my own hypothetical field names:


dropdownBox('answerid', SELECT answerid, CONCAT(questions.description,' 
- ',answers.description) AS display FROM questions LEFT JOIN answers ON 
questions.questionid=answers.questionid ORDER BY questions.description, 
answers.description, $myrow['answerid'], 'Question and Answer', 'Choose 
an Answer');


For more information on this function:

http://www.thinkcomputer.com/software/lampshade/documentation.html?function=dropdownBox 



I'd be happy to help you get it set up if you have any questions.

Aaron

Aaron Greenspan
President  CEO
Think Computer Corporation

http://www.thinkcomputer.com



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Dropdown Building Function

2005-07-29 Thread Jack Jackson



Kristen G. Thorson wrote:
I'm not 100% sure where you're saying you're stuck, but I think you're 
trying to do with one query what you will probably find is best to do 
with several.  Hopefully the following will help some:



//first get all the questions
$sql = select * from questions;
$result = mysql_query( $sql );

//now one-by-one go through the questions
while( $row = mysql_fetch_row( $result ) {

   //create the drop down box for THIS question
   echo 'select name='.$row['question_text'].'';

   //get all of the answers for THIS question
   $ans_sql = select * from answers where 
question_id=.$row['question_id'];

   $ans_result = mysql_query( $ans_sql );
   while( $ans_row = mysql_fetch_row( $ans_result ) ) {

  //list the answers for THIS question
  echo 'option 
value='.$ans_row['answer_id'].''.$ans_row['answer_text'].'/option';

   }
   echo '/select';
}

outputs:
select name=question1
option value=1answer 1/option
option value=2answer 2/option
option value=3answer 3/option

select name=question2
option value=1answer 1/option
option value=2answer 2/option
option value=3answer 3/option
option value=4answer 4/option
option value=5answer 5/option



It requires numerous DB calls, but I believe in most cases, it's still 
better than what you'd have to do otherwise (create some arrays and do 
some sorting, etc.).  That is, if I've understood what you need ;)




 And it did!!
//first get all the questions
$sql = select * from questions ORDER BY q_cat;
$result = mysql_query($sql);

//now one-by-one go through the questions
while($row = mysql_fetch_assoc($result)) {

//if the form has been submitted, and the question unanswered
//highlight this whole question and answer block in red.
if (sizeof($message[$row['q_name']])){
echo div class='error';
}

//State the question
echo div class='question';
echo $row['q_text'] . /div;
echo \n\n;
echo  div class='answer';
echo \n;

//Create the dropdown for the answers
echo '  select name=' . $row['q_name'] . '';
echo \n;

//get all of the answers for THIS question
$ans_sql = select * from answers where answers.q_id= . $row['q_id'];
$ans_result = mysql_query($ans_sql);

echo option value=\\Select from this list/option\n;
while($ans_row = mysql_fetch_assoc($ans_result)) {

//list the answers for THIS question
echo option ;
echo value=\ . $ans_row['a_id'] . \;

if  ($row['q_name'] == $ans_row['a_id']) {
echo  selected;
}

echo  . $ans_row['a_answer'] . /option;
echo \n;
}
echo '  /select' . \n . ' /div' . \n\n;
//If there *was* an error div, close it
if (sizeof($message[$row['q_name']])){
echo /div!--/error--;
}
}



Thanks so much!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Multipage form redux

2005-07-28 Thread Jack Jackson

Somehow my intent has been turned around here and I apologise.

I do not want to use *any* client side validation. I only want to do 
server side validation and server side storage.


My intent was to remove the client from as much as possible of this - if 
I didn't need their information I wouldn't even allow clients!! :)


What I wanted to do was this:


p. 1 : I send client page one, they send answers. SUBMIT sends to page 2 
script.


p 2. Before displaying anything to the client, Page 2 script validates 
input from page 1. If there are problems, page 2 script redisplays page 
one questions with highlights around problems. Clicking submit then 
resubmits page one data to page 2 script.


Once page 2 script validates all page 1 answers, page 2 script stores 
all those answers to a SESSION, then sends PAGE 2 QUESTIONS ONLY (no 
$_POST information) to client. Client answers page 2 questions and 
clicking submit submits PAGE 2 QUESTIONS to page 3 script.


p 3. Before displaying anything to the client, Page 3 script validates 
input from page 2 questions. If there are problems, page 3 script 
redisplays page 2 questions with highlights around problems. Clicking 
submit resubmits page 2 data to page 3 script.


Once page 3 script validates all page 2 answers, the script stores all 
those answers to a SESSION, then sends PAGE 3 QUESTIONS ONLY (no $_POST 
information) to client. Client answers page 3 questions and clicking 
submit submits PAGE 3 QUESTIONS to page 4 script.


At this point, if the client goes off for a bite, or two weeks 
backpacking in the Anapurna region, I'm fine, because the information is 
stored in the session (I have a very small group taking this 
questionnaire, all have a vested interested in filling it in, so I am 
not too worried abou their going aaway from it for more than a couple 
days max).


Once they complete the last set of questions, I say thanks much, get all 
the information out of their SESSION, insert it into the db, send 
confirmation emails all around and we're done.


Is this possible? How?

Thanks!



Marcus Bointon wrote:

On 27 Jul 2005, at 21:22, Jack Jackson wrote:


Right. Except I would rather have it working in a session because I  
specifically do not want to have the form sending $_POST data back  
and forth to the browser six times for several reasons. SO I'd like to


Page1 // User enters first batch of data, presses SUBMIT at bottom.  
Data is cleaned and written to SESSION, user passed to Page2


repeat as necessary to last page. At last page, process and error  
check newest input, then commit it, plus all previously stored  
session info to db.




As has also been said, Javascript can do this really nicely. The best  
example I've seen of this is in Mambo's (a popular PHP CMS) admin  
interface. It uses a tabbed multi-page form with client-side  
validation. It's really just one big page, so if the user has JS  turned 
off, they will get one big form with no client-side  validation, but it 
will still work. It's a really elegant way of  working. It doesn't 
require any server interaction between pages -  nothing is submitted 
until the form is complete.


See here for a howto: http://www.devx.com/webdev/Article/10483/1763/ page/1

Admittedly this approach doesn't easily allow to you abandon and  resume 
later (unless you get clever with JS and cookies).


For keeping data in a session, you could combine this approach with  
Ajax: http://particletree.com/features/smart-validation-with-ajax


Marcus


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Multipage form redux

2005-07-28 Thread Jack Jackson

The light dawns.

Thank you everyone for this explanation, and the help




JJ

Mark Rees wrote:

Jack Jackson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]


Somehow my intent has been turned around here and I apologise.

I do not want to use *any* client side validation. I only want to do
server side validation and server side storage.

My intent was to remove the client from as much as possible of this - if
I didn't need their information I wouldn't even allow clients!! :)

What I wanted to do was this:


p. 1 : I send client page one, they send answers. SUBMIT sends to page 2
script.

p 2. Before displaying anything to the client, Page 2 script validates
input from page 1. If there are problems, page 2 script redisplays page
one questions with highlights around problems. Clicking submit then
resubmits page one data to page 2 script.

Once page 2 script validates all page 1 answers, page 2 script stores
all those answers to a SESSION, then sends PAGE 2 QUESTIONS ONLY (no
$_POST information) to client. Client answers page 2 questions and
clicking submit submits PAGE 2 QUESTIONS to page 3 script.

p 3. Before displaying anything to the client, Page 3 script validates
input from page 2 questions. If there are problems, page 3 script
redisplays page 2 questions with highlights around problems. Clicking
submit resubmits page 2 data to page 3 script.

Once page 3 script validates all page 2 answers, the script stores all
those answers to a SESSION, then sends PAGE 3 QUESTIONS ONLY (no $_POST
information) to client. Client answers page 3 questions and clicking
submit submits PAGE 3 QUESTIONS to page 4 script.

At this point, if the client goes off for a bite, or two weeks
backpacking in the Anapurna region, I'm fine, because the information is
stored in the session (I have a very small group taking this
questionnaire, all have a vested interested in filling it in, so I am
not too worried abou their going aaway from it for more than a couple
days max).

Once they complete the last set of questions, I say thanks much, get all
the information out of their SESSION, insert it into the db, send
confirmation emails all around and we're done.



Sessions are used to identify users on a single visit to a website. They are
not intended to track users who turn off their machines, then turn them on
again and visit the website again. There are various ways of doing this, and
for all I know it may be possible with sessions, but I don't recommend you
try.

Do as suggested previously by various posters, it is the simplest and most
robust solution to your problem:

1. have the user register their details first up. Store this in a db, and
use it to identify the user on any subsequent visit.
2. when each page is submitted, write the information into the db. This way
it will definitely be associated with the right user
3. Whenever a user revisits the questionnaire, make them log in, then take
them to wherever they were up to - you will be able to work this out from
the amount of data you have recorded against them.

e.g. database table

userid
question
question
question
question
question
question









Is this possible? How?

Thanks!



Marcus Bointon wrote:


On 27 Jul 2005, at 21:22, Jack Jackson wrote:




Right. Except I would rather have it working in a session because I
specifically do not want to have the form sending $_POST data back
and forth to the browser six times for several reasons. SO I'd like to

Page1 // User enters first batch of data, presses SUBMIT at bottom.
Data is cleaned and written to SESSION, user passed to Page2

repeat as necessary to last page. At last page, process and error
check newest input, then commit it, plus all previously stored
session info to db.



As has also been said, Javascript can do this really nicely. The best
example I've seen of this is in Mambo's (a popular PHP CMS) admin
interface. It uses a tabbed multi-page form with client-side
validation. It's really just one big page, so if the user has JS  turned
off, they will get one big form with no client-side  validation, but it
will still work. It's a really elegant way of  working. It doesn't
require any server interaction between pages -  nothing is submitted
until the form is complete.

See here for a howto: http://www.devx.com/webdev/Article/10483/1763/


page/1


Admittedly this approach doesn't easily allow to you abandon and  resume
later (unless you get clever with JS and cookies).

For keeping data in a session, you could combine this approach with
Ajax: http://particletree.com/features/smart-validation-with-ajax

Marcus





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Multipage form redux

2005-07-28 Thread Jack Jackson



Mark Rees wrote:

André Medeiros [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]


The point of sessions is that when you close your browser, you loose it.
I'm affraid that if you want sessions that last two weeks, you'll have
to make your own session handler :) but yeah, it's possible, and it
beats the crap out of the fill form, store in db, fill form, store in
db method.



Unless your user wishes to complete the form from a different machine, of
course.

I really don't understand the dogmatic antipathy to storing information in
the database. Sometimes it is a better solution - horses for courses.
Rolling your own session management tool, whilst undoubtedly fun and
satisfying, is hardly an appropriate solution to this type of enquiry, which
is apparently from someone taking their first steps in web development.

I should probably explain that I come from an ASP background and so have an
inherent mistrust of sessions, although I am coming to understand that PHP
sessions are much more reliable.

Sorry about the three posts before, my mistake.






No, I think I wasn't clear because of a fundamental misunderstanding on 
my part of the problem of SESSIONS not lasting between ... uh... 
sessions. In fact I think my very first post on the subject did in fact 
say I wanted to store the answers on the db throughout the process, but 
I got so excited at the prospect of having sessions store things that I 
got distracted.


Anyway, thanks again to all who replied and for all the help I generally 
receive here on the list!!


JJ

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Dropdown Building Function

2005-07-28 Thread Jack Jackson

Hi,
because that last topic on multipage forms was so exciting, I decided to 
database the questions as well. I wonder if anyone can help me with a 
function to pull rows into dropdown boxes.


It's a 1:n relationship between questions and answers, and I have a 
table of questions


q_id
q_name
q_text
q_style //dropdown, radio, checkboxes
q_cat //question category

and a table full of answers

a_id
q_id
a_answer


When I do

$fields = 'SELECT *';
$from = 'FROM questions,answers';
$sort = ORDER BY questions.q_cat;
$where = WHERE answers.q_id=questions.q_id;

// construct the sql query:
$sql = $fields $from $where $sort;

// Run SQL query 1
if (!($result = mysql_query($sql))) {
echo Could not connect to the database ($sql) . mysql_error();
}

while ($row = mysql_fetch_assoc($result)) {


I need to loop through the results and make a dropdown list from them, 
taking the question name as the select name, and then making each answer 
id and answer text the makings of an option ros.


Based on a problem a while ago which was similar but different, someone 
here actually made me a function *similar* to what I need to do now, 
This one acts different and I just cannot adapt the old one, because I 
still get confused at this level.


I think it wants to be something like (and note that part of the return 
is the code to react to error checking results):


$dropdown[] = 'option ?php if (' . $q_name . ' == ' . $a_id . ') 
echo selected ; ? value=\'' . $a_id . '\'' . $a_answer . '/option';


etc for all $a_answer(s)...
and then

return '?php if (sizeof($message[\'' . $q_name . '\'])){ echo div 
class='error'; } ?

div class=\'row\'
select class=\'answer\' name=\'' . $q_name . '\'
option value=\'\'Select from this list/option'
 join('',$dropdown)
 . '/select/div'
 . '?php if (sizeof($message[\''. $q_name '\'])){ echo 
/div!--/error--; } ?';



Can anyone point me at the right direction?

Thanks!!

JJ

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Multipage form redux

2005-07-27 Thread Jack Jackson

Hi,
I have searched the archives and seen links to tutorials at phpclasses 
(which seem to be down) and not found an answer to my question:
I have a long form I want to break into seven pages. Rather than pass 
values from page to page as hidden, I'd rather write the results to the 
db after each page then move on.


Anyone know of any tutorials on this?

Thanks in advance,
JJ

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Multipage form redux

2005-07-27 Thread Jack Jackson
Thanks everyone. I take the point of Andre, but believe that the depth 
and sensitivity of the data require it be stored server side. I think 
that Richard and Mark have put their fingers on it - it's gotta be 
cookie based. Someone on the IRC suggested sessions and I think that it 
the way it goes. As for the idea that new users would be sent packing by 
such a ridiculously long form, right on! This is a form to be filled in 
by a client of the company after they've hired to company to provide an 
assessment of ther practices, so they'd expect a long form. But point taken


Thanks everyone for replying so quickly!

I'll come back when I botch the sessions and need help fixing!!

JJ


Richard Davey wrote:

Hello André,

Wednesday, July 27, 2005, 2:22:30 PM, you wrote:

AM That's not a very good idea. Imagine the user gets to the fourth
AM form and gets a cup of coffee, or goes out to lunch. By the time
AM he gets to the computer he might have lost the session, thus
AM having data on your DB that is wasting space.

AM And what if the user closes the browser window? :)

All of those things are unavoidable no matter what technique you use
:)

I've seen multi-page forms with a Finish this later option that
issues a cookie to your browser, allowing you to visit the site at any
(realistic) point in the future and carry on. In which cases the
part-filled contents must already be in a database somewhere. This
isn't a bad thing imho, it's a nice touch.

Of course it's prone to the usual browser doesn't accept cookies /
browser deletes cookies syndrome though.

If you don't want to pass the form values across in a hidden manner
(and I don't blame you) then it's either dump it all in a session and
hope it doesn't time-out, or dump it into a database, issue the
visitor some link to that entry (cookie, session var) and again hope
they don't time out.

The only real difference being the DB option will need purging to get
rid of incomplete forms  X days old. But that in itself could prove a
useful statistic for reports. Unless you're dealing with thousands of
sign-ups an hour, I don't see any issue with this option.

Another technique might be the following - rethink how your forms
work. Exactly what is it you're collecting data about? If it's part of
a long sign-up process then you could consider changing the process
around a bit - so that the VERY first thing the user does is create a
temporary account on your site (call them incomplete users). So you
grab some method of login + authentication details from them. Then the
form pages following this can all be saved to a DB and linked to that
user.

So, as long as they complete this first step, they can always come
back and finish the job off - whenever they want, avoiding cookie and
session time-out issues.

This won't work for all forms of course, it depends what the nature of
the process is, but it's certainly an option.

Best regards,

Richard Davey


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Multipage form redux

2005-07-27 Thread Jack Jackson

hi, my first attempt at a sessions-based form is starting at

http://pastebin.com/322696

and I have a question. What I want to do is, after the user answers the 
questions in section one and they are error checked, I want to write the 
answers to $_SESSION() and then continue down the script to the next 
page of questions. I do *not* want to re-send the answers from page one 
as $_POST vars back to the user and have the user submit the answers to 
page 2 plus the $_POST answers from page 1.




What I am doing now is clearly wrong, basically :

if (empty($error)) {
include_once($page2);
}

because that's keeping it all in one script. But how should I be getting 
to the next page, sending headers to a new script, and at the end of the 
chain the script which pulls it all together?


Thanks in advance,

JJ






Jack Jackson wrote:





Thanks everyone. I take the point of Andre, but believe that the depth 
and sensitivity of the data require it be stored server side. I think 
that Richard and Mark have put their fingers on it - it's gotta be 
cookie based. Someone on the IRC suggested sessions and I think that it 
the way it goes. As for the idea that new users would be sent packing by 
such a ridiculously long form, right on! This is a form to be filled in 
by a client of the company after they've hired to company to provide an 
assessment of ther practices, so they'd expect a long form. But point taken


Thanks everyone for replying so quickly!

I'll come back when I botch the sessions and need help fixing!!

JJ


Richard Davey wrote:


Hello André,

Wednesday, July 27, 2005, 2:22:30 PM, you wrote:

AM That's not a very good idea. Imagine the user gets to the fourth
AM form and gets a cup of coffee, or goes out to lunch. By the time
AM he gets to the computer he might have lost the session, thus
AM having data on your DB that is wasting space.

AM And what if the user closes the browser window? :)

All of those things are unavoidable no matter what technique you use
:)

I've seen multi-page forms with a Finish this later option that
issues a cookie to your browser, allowing you to visit the site at any
(realistic) point in the future and carry on. In which cases the
part-filled contents must already be in a database somewhere. This
isn't a bad thing imho, it's a nice touch.

Of course it's prone to the usual browser doesn't accept cookies /
browser deletes cookies syndrome though.

If you don't want to pass the form values across in a hidden manner
(and I don't blame you) then it's either dump it all in a session and
hope it doesn't time-out, or dump it into a database, issue the
visitor some link to that entry (cookie, session var) and again hope
they don't time out.

The only real difference being the DB option will need purging to get
rid of incomplete forms  X days old. But that in itself could prove a
useful statistic for reports. Unless you're dealing with thousands of
sign-ups an hour, I don't see any issue with this option.

Another technique might be the following - rethink how your forms
work. Exactly what is it you're collecting data about? If it's part of
a long sign-up process then you could consider changing the process
around a bit - so that the VERY first thing the user does is create a
temporary account on your site (call them incomplete users). So you
grab some method of login + authentication details from them. Then the
form pages following this can all be saved to a DB and linked to that
user.

So, as long as they complete this first step, they can always come
back and finish the job off - whenever they want, avoiding cookie and
session time-out issues.

This won't work for all forms of course, it depends what the nature of
the process is, but it's certainly an option.

Best regards,

Richard Davey





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Multipage form redux

2005-07-27 Thread Jack Jackson

Jim Moseby wrote:

-Original Message-
From: Jack Jackson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 27, 2005 3:47 PM
To: php  [php] PHP General List
Subject: Re: [PHP] Multipage form redux


hi, my first attempt at a sessions-based form is starting at

http://pastebin.com/322696

and I have a question. What I want to do is, after the user 
answers the 
questions in section one and they are error checked, I want 
to write the 
answers to $_SESSION() and then continue down the script to the next 
page of questions. I do *not* want to re-send the answers 
from page one 
as $_POST vars back to the user and have the user submit the 
answers to 
page 2 plus the $_POST answers from page 1.




What I am doing now is clearly wrong, basically :

if (empty($error)) {
include_once($page2);
}

because that's keeping it all in one script. But how should I 
be getting 
to the next page, sending headers to a new script, and at the 
end of the 
chain the script which pulls it all together?


Thanks in advance,

JJ




This seems so simple to me.  As I understand it, you want to split a data
entry session into several pages.  You don't want to collect the data and
submit it all at the end, but instead commit it to session variables along
the way.  Am I missing something? 


Here's how I would do it in a nutshell:

Page1 // User enters first batch of data, presses SUBMIT at bottom.  Data is
POSTed to Page2

Page2 // Commit data from page 1 to session variables, then displays form
for next batch of data.  User presses SUBMIT, posts data to Page 3.

Page3 // Commit data from page 2 to session variables, then displays form
for next batch of data.  User presses SUBMIT, posts data to Page 4.

... etc etc etc  (Each page begins by assigning data from the previous page
to session variables)

Page515 // Displays all session variables set in previous pages, asks user
to confirm.  User confirms by pressing SUBMIT, confirmation POSTed to page
516, who writes it all to the database, and sends confirmation email.

Personally, I would take the advice of a previous poster and start off
assigning a username and password to the user.  Then store each page in the
database as the user progresses.  That way, if he is interrupted in the
middle of the process, he won't lose all his data and have to start over.
He can just enter his username and pick up where he left off. You will just
have to  write a script that purges old incomplete records. (A great job for
cron!)

JM




Right. Except I would rather have it working in a session because I 
specifically do not want to have the form sending $_POST data back and 
forth to the browser six times for several reasons. SO I'd like to


Page1 // User enters first batch of data, presses SUBMIT at bottom. 
Data is cleaned and written to SESSION, user passed to Page2


repeat as necessary to last page. At last page, process and error check 
newest input, then commit it, plus all previously stored session info to 
db.


Does this make sense?

Thanks in advance

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Prepopulating form fields afer an error

2005-07-25 Thread Jack Jackson

Hi,
I have a form and it does basic error checking after submission; when 
the user omits required fields it kicks back the form with highlighted 
errors telling them the error of their ways.


I've sussed out that by populating the value of the field with 
$fieldvalue I can have that form field populated with the data the 
user *did* enter for that field:


something like

input type=text name=email_address value=?php echo $email_address?

That works great. But how can I do the same thing for drop down boxes, 
when they select an option?


I tried the unwieldy,

select name='blah'
 ?php if (!empty(blah)) {
echo option value=';
echo $blah;
echo '
echo $blah;
echo /option\n;
}
   ?


And that, lo and behold, didn't work. Can anyone offer a suggestion?

Thanks in advance
JJ

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Prepopulating form fields afer an error

2005-07-25 Thread Jack Jackson

Thanks so much, Mark, Matt and John! I'll play with all those.

Much appreciated,

JJ

Mark Cain wrote:

Here's the way I do it:

The following is an HTML code snippet with embedded PHP code for the
intelligence.

select name=shipper
 option value=DHL ? if ($shipped_via == DHL) echo selected;
?DHL
 option value=FedEx ? if ($shipped_via == FedEx) echo selected;
?FedEx
 option value=UPS ? if ($shipped_via == UPS) echo selected;
?UPS
/select




Mark Cain


- Original Message -
From: Jack Jackson [EMAIL PROTECTED]
To: [php] PHP General List php-general@lists.php.net
Sent: Monday, July 25, 2005 2:37 PM
Subject: [PHP] Prepopulating form fields afer an error




Hi,
I have a form and it does basic error checking after submission; when
the user omits required fields it kicks back the form with highlighted
errors telling them the error of their ways.

I've sussed out that by populating the value of the field with
$fieldvalue I can have that form field populated with the data the
user *did* enter for that field:

something like

input type=text name=email_address value=?php echo $email_address?

That works great. But how can I do the same thing for drop down boxes,
when they select an option?

I tried the unwieldy,

select name='blah'
 ?php if (!empty(blah)) {
echo option value=';
echo $blah;
echo '
echo $blah;
echo /option\n;
}
   ?


And that, lo and behold, didn't work. Can anyone offer a suggestion?

Thanks in advance
JJ

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php









--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Zipping on the fly

2005-06-29 Thread Jack Jackson

hi,
I'm providing a download script which lets trusted users view a 
directory and select a file to download; I don't want to store the files 
zipped on the server. Is there a fast, built-in way to zip the selected 
file on the fly and let the user download the zipped copy? I looked at 
php.net/zip and didn't see any...


Thanks in advance

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Zipping on the fly

2005-06-29 Thread Jack Jackson

Thanks for this Philip and Andre!

Philip Hallstrom wrote:

hi,
I'm providing a download script which lets trusted users view a 
directory and select a file to download; I don't want to store the 
files zipped on the server. Is there a fast, built-in way to zip the 
selected file on the fly and let the user download the zipped copy? I 
looked at php.net/zip and didn't see any...



http://marc.theaimsgroup.com/?r=1w=2q=bl=php-generals=zip

Read the PHP ZIP Class messages...





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Verifying images with getimagesize()

2005-06-25 Thread Jack Jackson



Edward Vermillion wrote:

Sorry to reply to this message but I wanted the OP to find it too...

On Jun 23, 2005, at 9:42 AM, Jack Jackson wrote:
[snip]

Through your help I was able to validate image files using 
getimagesize() and have made a nice script to upload and rename images.



[\snip]

I've been meaning to post a reply to a problem I ran into a while back 
that included validating images with getimagesize(). I've seen a few 
posts from folks saying this is the way to go and just want to share my 
experiences.


My original problem was that a script I had for batch generating 
thumbnails from uploaded images was running out of memory. With Richard 
Lynch's help I was able to track the problem to createimagefromjpeg() 
using an unholy amount of memory on one particular file, a file that had 
passed through getimagesize() with no problems.
What I found was that if an image ( in this case a jpeg ) is corrupted, 
but just barely, getimagesize() will let it through. Just for the record 
I could open it up in Photoshop and that's how I discovered that it was 
corrupted, the last ten or fifteen rows on the image were gone. 
Photoshop showed an uncompressed file size of 11M for this image. But 
what I had to end up doing is setting my memory limit to 48M before 
createimagefromjpeg() could get enough memory to work with that it 
finally failed.


Just a heads up to anyone that's using getimagesize() to verify an image 
before running it through createimagefromjpeg(), just because it passes 
getimagesize() doesn't necessarily mean it's a good image.


Edward Vermillion
[EMAIL PROTECTED]

Thanks for telling me about that, Edward. I apprecate it. Actually in 
this case I was using it only to verify that it was something like an 
image to validate the file type before allowing it on the server. But 
you raise a very good point and I appreciate it.


JJ

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Uploading and verifying word and excel files

2005-06-24 Thread Jack Jackson

Thank you for ALL this great information, Richard! I really appreciate
all the help.

JJ
Richard Lynch wrote:

On Thu, June 23, 2005 7:42 am, Jack Jackson said:


I cannot see a way to validate or examine Word or Excel files for
validity (and assume that older word files would validate differently
from newer ones).



If your PHP does not have the mime_type functions, you could probably use
http://php.net/exec with the file utility which does much the same thing
under Un*x-like systems.

man file on the command line for more info.



The PEAR http upload script mentioned twice in the user notes at that
manual page does not *seem* to validate other than denying certain
extensions like php, php3, etc. I could be wrong of course.



Does it catch .asp, .cgi, .pl, .htm, .html, .jpg, .png, .gif, .jpeg, .pdf,
and .swf?

Cuz at certain directories on *my* server, those are all PHP scripts!

Well, okay, .pl and .cgi aren't.  Actually, I think I still have a .cgi
somewhere that *is* a PHP script...  It's equally dangerous either way.

Maybe someday they will be on your server, too, once you run into the
zillion IE bugs where the URL counts for more than the Content-type:
header.

It's really Bad Practice to rely on the last N characters of a filename as
some kind of Security Measure to stop a serious attack...



Also, it seems that directories must be blown wide open (777) to allow
the script to copy the file over from /tmp. My ISP won't allow
directories to be set to 777 under public_html/ -- but we need to access
the files via web browser which is the whole point.



Well, requring 777 just plain sucks...

You *should* have a directory writable by the PHP user/group as the
minimum requirement.

If PEAR really and truly requires 777, then that feature of PEAR sucks,
and you shouldn't use it.  Sorry, PEAR guys.  Gotta call 'em as I see 'em.

And if the best it can do is outlaw .php .php3 ..., then that ain't much
either.  I'd rather code it myself than have that weak of a safety.



So my questions:
1. How do you validate Word and Excel files before upload?



You don't.

Any validation done before upload is done on the client, and is therefore
something that can be easily bypassed by the savvy user.

It might be useful as a User-Interface feature to catch obvious stupid
mistakes by honest folk...

But it's USELESS as a Security Measure to stop Bad Guys.

Oh yeah:

You may need to use move_uploaded_file to move the files to a staging area
before you use exec/file on them...

At least, under *MY* webhost's setup, I can't directly read PHP uploaded
files from /tmp, even though PHP can move_uploaded_file() them... That may
have been changed/fixed, but it's a possible configuration issue.

So, use move_uploaded_file to let PHP do its checks, but put stuff in a
staging area that the PHP user can read/write, and is *NOT* in the
web-tree.

Then, do all of YOUR checks.  getimagesize, exec(/usr/bin/file $file...)
etc.

If that all passes, move the file (again) to its final destination, which
should *still* be out-side the web tree on most shared servers.

Write a PHP script that only allows files already listed in your database
to be served up, and which readfile's the data from outside the webtree to
spew it out.

*IF* you are on a dedicated server, or *IF* your webhost has a unique
UID/GID for you to have directories that no *OTHER* user on that webhost
can write to your PHP-writable directories/files, *then* it is
probably/maybe just as safe to put stuff in your webtree as to readfile it
from outside the web tree...

Even then, I'd only do the direct to webtree if performance was a major
issue.  It just doesn't make sense to me to let untrusted users put stuff
in the webtree where they might manage to trick the server into executing
it as Perl, PHP, JSP, ASP, or [deity] knows what code to do Evil things.

It's gonna be a lot tougher for them to fool PHP's readfile into executing
code.  Hell, if they can do that, they already own your server.



2. How can I make a passthrough from a file above public_html to one
below it so that people can surf in with a browser and download files
which have been uploaded by the script?



There's an easy one. :-)

Put the files *OUTSIDE* your webtree.

Then write a PHP script that takes an ID of a valid uploaded file that
your previously stored in your database, looks up the path to that file,
and use http://php.net/readfile on it.

You were real close with passthrough which is http://php.net/passthru
which is kind of the same, only not.

You'd only put files in the webtree if PHP readfile proved too slow, *AND*
you were sure no user on the box could ever manage to infiltrate a
damaging file into the webtree...

That second one is a pretty Tall Order...

I can see somebody justifying it, but, honestly, if the overhead of
readfile is that big of a deal, then maybe you're living too close to the
edge on performance in the first place, and it's time to buy more/better
hardware anyway

[PHP] Uploading and verifying word and excel files

2005-06-23 Thread Jack Jackson

Hi,
I checked at http://www.php.net/manual/en/features.file-upload.php and 
all the user notes, and also the PEAR solution for uploading files and I 
still have a couple of questions.


I need to create a form to allow users to upload (and later to delete) 
MS word, excel and jpg files. Through your help I was able to validate 
image files using getimagesize() and have made a nice script to upload 
and rename images.


I cannot see a way to validate or examine Word or Excel files for 
validity (and assume that older word files would validate differently 
from newer ones).


The PEAR http upload script mentioned twice in the user notes at that 
manual page does not *seem* to validate other than denying certain 
extensions like php, php3, etc. I could be wrong of course.


Also, it seems that directories must be blown wide open (777) to allow 
the script to copy the file over from /tmp. My ISP won't allow 
directories to be set to 777 under public_html/ -- but we need to access 
the files via web browser which is the whole point.



So my questions:
1. How do you validate Word and Excel files before upload?

2. How can I make a passthrough from a file above public_html to one 
below it so that people can surf in with a browser and download files 
which have been uploaded by the script?


Thanks in advance,
JJ

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Uploading and verifying word and excel files

2005-06-23 Thread Jack Jackson


John Nichel wrote:

Jack Jackson wrote:
snip

Also, it seems that directories must be blown wide open (777) to allow 
the script to copy the file over from /tmp. My ISP won't allow 
directories to be set to 777 under public_html/ -- but we need to 
access the files via web browser which is the whole point.



It shouldn't have to be this way.  The webserver should be configured to 
run as your virtual user, or belong to a group which has write 
permission to that directory, or.I'm getting a bit off track with 
that.  This is something you'll have to take up with your ISP.


Will do.




So my questions:
1. How do you validate Word and Excel files before upload?



Before?  JavaScript...if JavaScript can even do it (I haven't touched 
the stuff in ages).  After upload, you can check the mime type, but 
that's not foolproof.




Okay, sorry I miswrote: after upload to the temp directory, BEFORE using 
move_uploaded_file(). Checking the mime type is the problem - if I can't 
trust the browsers am I really reliant on the file extension? Can't I 
peek in some manner into it as we do with getimagesize()?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Uploading and verifying word and excel files

2005-06-23 Thread Jack Jackson



Tom Rogers wrote:

Hi,

Friday, June 24, 2005, 12:42:33 AM, you wrote:
JJ Hi,
JJ I checked at
JJ http://www.php.net/manual/en/features.file-upload.php and 
JJ all the user notes, and also the PEAR solution for uploading files and I

JJ still have a couple of questions.

JJ I need to create a form to allow users to upload (and later to delete)
JJ MS word, excel and jpg files. Through your help I was able to validate
JJ image files using getimagesize() and have made a nice script to upload
JJ and rename images.

JJ I cannot see a way to validate or examine Word or Excel files for 
JJ validity (and assume that older word files would validate differently

JJ from newer ones).

JJ The PEAR http upload script mentioned twice in the user notes at that
JJ manual page does not *seem* to validate other than denying certain
JJ extensions like php, php3, etc. I could be wrong of course.

JJ Also, it seems that directories must be blown wide open (777) to allow
JJ the script to copy the file over from /tmp. My ISP won't allow 
JJ directories to be set to 777 under public_html/ -- but we need to access

JJ the files via web browser which is the whole point.


JJ So my questions:
JJ 1. How do you validate Word and Excel files before upload?

JJ 2. How can I make a passthrough from a file above public_html to one
JJ below it so that people can surf in with a browser and download files
JJ which have been uploaded by the script?

JJ Thanks in advance,
JJ JJ

The first 8 bytes of an ole2 file (exel and word are ole2 files I
think) should have the following hex sequence:

\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1

So do an fopen and read in the first 8 bytes and compare it to that
string should give some indication.

Cl. Thank you Tom and all those who replied. I always learn so much 
here!


JJ

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Amy's Site question

2005-06-22 Thread Jack Jackson

Hello,

On a site I'm listing measurements in both inches and cm; in the db 
they're stored as inches. To convert them to cm I'm doing:


?php echo ($cartoon['art_width'] * 2.54); ? x ?php echo 
($cartoon['art_height'] * 2.54); ? cm



How can I limit the result of that math to one decimal place, ie, 9.5 
cm, not 9.523 cm?


Thanks in advance,
JJ

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Amy's Site question

2005-06-22 Thread Jack Jackson
Thanks everyone! I did look in the manual under operators and must have 
missed the link to round. Thanks to all who replied!




Simon Allison wrote:

http://au3.php.net/round


-Original Message-
From: Jack Jackson [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, 22 June 2005 9:18 PM

To: [php] PHP General List
Subject: [PHP] Amy's Site question

Hello,

On a site I'm listing measurements in both inches and cm; in the db 
they're stored as inches. To convert them to cm I'm doing:


?php echo ($cartoon['art_width'] * 2.54); ? x ?php echo 
($cartoon['art_height'] * 2.54); ? cm



How can I limit the result of that math to one decimal place, ie, 9.5 
cm, not 9.523 cm?


Thanks in advance,
JJ



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] rename

2005-06-18 Thread Mister Jack
Hi,

I would like to know precisely what rename do in case of error. any
link for that ?
I do a : @rename($old, $new), what happens if I run out of space ? is
the rename just an alias for C function library ?
thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: rename

2005-06-18 Thread Mister Jack
Hi,

That's what I've done, but I does not say clearly _when_ @rename
should failed. I've read the documentation in the C library for Unix,
and it says that it failed when it can't _add_ an entry to the
directory. What I observe is an empty file...
still weird, I'll look depper into it. (since i've been bitten by it
with my website being 'blank page' since it grew out of space...)
Thanks,

On 6/18/05, Bob Winter [EMAIL PROTECTED] wrote:
 Look at http://us2.php.net/manual/en/function.rename.php
 
 Mister Jack wrote:
  Hi,
 
  I would like to know precisely what rename do in case of error. any
  link for that ?
  I do a : @rename($old, $new), what happens if I run out of space ? is
  the rename just an alias for C function library ?
  thanks
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Those checkboxes again

2005-06-16 Thread Jack Jackson

hi,
I'm severely frustrated and perhaps you can help with what I have done 
wrong. The checkboxes I use to populate an intersection table work to 
add the records, and now I am trying to update them. It's almost there 
but producing some unexpected results when the form is submitted: the 
idea is that it displays the checkboxes as pre-selected if they're 
associated with the art_id in the intersection table. They're now 
appearing as all unselected. Any help is appreciated.


?php

$query = '';
$result = 0;
$art_id = $_POST['art_id'];

print_r($_POST);

if (isset($_POST['editrecordMedia'])){

if (!empty($_POST['media_types'])) {

foreach($_POST['media_types'] as $type)
 {
 $query = UPDATE media_art SET
 media_id='$type',
 art_id='$art_id';
var_dump($query);
 mysql_query($query) or die(mysql_error());

 }
}

else {echo mediatypes is empty;}
//Closes if (!empty($media_types))
}//closes if (isset($_POST['editrecordMedia'])

//If editrecord hasn't been set, but selectcartoon has, get the 
cartoon's recordset


//This is just to get the title for display purposes
$query = SELECT art_title
FROM art
WHERE art_id='$art_id';
//end

$media_query = SELECT media.media_id,
media.media_name,
media_art.art_id
FROM media
LEFT JOIN media_art
ON media_art.media_id=media.media_id
AND media_art.art_id='$art_id';

//These $art results are just to get the title for display purposes
$art_result = mysql_query($query);  
$art_rows = mysql_fetch_assoc($art_result);
//end

$media_result = mysql_query($media_query);
$checkbox_media = array ();


while ($media_rows = mysql_fetch_assoc($media_result)){

	$checkbox_media[] = input type='checkbox' name='media_types[]' 
value='{$media_rows['media_id']}' ;


if ($media_rows['art_id'] === $art_id) {
$checkbox_media[] .= checked ;
}

$checkbox_media[] .= /{$media_rows['media_name']}  ;


}

?

table align=center
trth colspan=4Main Menu/th/tr
tr
tda href=addrecord.phpAdd A Record/a/td
tda href=chooserecord.phpEdit A Record/a/td
tda href=deleterecord.phpDelete A Record/a/td
/tr
/table

form action=?php echo $_SERVER['PHP_SELF']; ? method=post 
name=editrecordMedia

input type=hidden name=art_id value=?php echo $art_id ;?
 Choose media related to strong?php echo 
$art_rows['art_title'];?/strongbr /br /


 Media: ?php echo join($checkbox_media); ?

input type=submit name=editrecordMedia value=Update
/form

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Image upload form

2005-06-16 Thread Jack Jackson



Nadim Attari wrote:

http://www.php-help.net/sources-php/image.upload.function.353.html


Thanks, Nadim,
I'm sure that is a great script. I am really trying to learn how it's 
working, so I'm trying to stay away from pre-rolled stuff as much as I 
can and beg for the mercy of the list in building these simple scripts. 
Believe it or not I'm actually improving pretty fast (despite 
scriptorial evidence to the contrary on this list)!


Thanks again,
JJ




Regards,
Nadim Attari
Alienworkers.com




Hi, After a disastrous first attempt (which uploaded images but only by
chance) it was suggested I rework the entire thing. This one seems to
check the file against getimagesize and if that doesn't prove false,
check the type and make the extension then rename the file. But the
moving part is not working, and it does not kick back any error, it just
fails.

Can anyone tell me what I am doing wrong, and also if this is sufficient
to a) upload images safely and b) protect against tampering?

Thanks in advance,
JJ


?php

error_reporting(E_ALL);

  $uploaddir = images/jpg/test/;

//  print_r($_FILES);

  $local_file = $_FILES['userfile']['tmp_name'];

if (sizeof($local_file))
  {

//try to get image size; this returns false if this is not an actual
image file.
  $image_test = getimagesize($local_file);

if ($image_test !== false) {
  $mime_type = $_FILES['userfile']['type'];
  switch($mime_type) {
  case image/jpeg:
  $pext = 'jpg';
  break;
  case image/tiff:
  $pext = 'tif';
  break;
  default:
  echo The file you are trying to upload is an image, but it is not
a tif or jpeg and therefore unacceptable.;
  }
} else {
   echo The file you are trying to upload is not a valid image file;
}

 $main_image = md5(date(l-F-j-Y i:s)).'.'.$pext;


  move_uploaded_file($main_image,$uploaddir);

  }

  ?

  form enctype=multipart/form-data action=?php echo
$_SERVER['PHP_SELF']; ? method=POST
input type=hidden name=MAX_FILE_SIZE value=30 /
!-- Name of input element determines name in $_FILES array --
Cartoon: input name=userfile type=file /
input type=submit value=Upload File /
/form





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] A more sane problem description

2005-06-16 Thread Jack Jackson

Sorry,
The last post I made was fairly incomprehensible.

I'm trying to

a) edit information which is already in an intersection table, while
b) allowing the user to add new information to the intersection table

The information in it is pulled from the table media_art and I grab the 
media_art_id, media_id and art_id.


If a media_id is associated with an art_id in the table, I grab all 
three and make the checkbox for that media_id checked.


I need to understand how I can make it so that

a) if the user UNchecks the box, then the row containing that media_id 
will be deleted.


AND

b) if the user checks a new box, a new row will be inserted into the 
media_art table containing the media_id and the art_id.


This is so far beyond my comprehension it's not even funny.

This is what I have so far - thank you in advance for the help.:


?php

$query = '';
$result = 0;
$art_id = $_POST['art_id'];
$media_art_id = $_POST['media_art_id'];
//print_r($_POST);

if (isset($_POST['editrecordMedia'])){

if (!empty($_POST['media_types'])) {

foreach($_POST['media_types'] as $type)
 {  
 $query = UPDATE media_art SET
 media_id='$type',
 art_id='$art_id'
 WHERE media_art_id='$media_art_id'
 LIMIT 1;
print_r($query);
 mysql_query($query) or die(mysql_error());

 }
}

else {echo mediatypes is empty;}
//Closes if (!empty($media_types))
}//closes if (isset($_POST['editrecordMedia'])

//If editrecord hasn't been set, but selectcartoon has, get the 
cartoon's recordset


//This is just to get the title for display purposes
$query = SELECT art_title
FROM art
WHERE art_id='$art_id';
//end

$media_query = SELECT media.media_id,
media.media_name,
media_art.art_id,
media_art.media_art_id
FROM media
LEFT JOIN media_art
ON media_art.media_id=media.media_id
AND media_art.art_id='$art_id';

//These $art results are just to get the title for display purposes
$art_result = mysql_query($query);  
$art_rows = mysql_fetch_assoc($art_result);
//end

$media_result = mysql_query($media_query);
$checkbox_media = array ();


while ($media_rows = mysql_fetch_assoc($media_result)){

	$checkbox_media[] = input type='checkbox' name='media_types[]' 
value='{$media_rows['media_id']}' ;


if ($media_rows['art_id'] === $art_id) {
		$checkbox_media[] .= checked 
media_art_id='{$media_rows['media_art_id']}';

}

$checkbox_media[] .= /{$media_rows['media_name']}  ;


}

?

table align=center
trth colspan=4Main Menu/th/tr
tr
tda href=addrecord.phpAdd A Record/a/td
tda href=chooserecord.phpEdit A Record/a/td
tda href=deleterecord.phpDelete A Record/a/td
/tr
/table

form action=?php echo $_SERVER['PHP_SELF']; ? method=post 
name=editrecordMedia

input type=hidden name=art_id value=?php echo $art_id ;?
 Choose media related to strong?php echo 
$art_rows['art_title'];?/strongbr /br /


 Media: ?php echo join($checkbox_media); ?

input type=submit name=editrecordMedia value=Update
/form

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  1   2   3   4   5   6   7   >