Re: [PHP] Looking for pointers to mysql functions

2004-11-11 Thread Stuart Felenstein

--- [EMAIL PROTECTED] wrote:

> This would be handled in your query,  so get a SQL
> book or look into the mysql documentation...
> 
> Look at the select statement, to request specific
> fields, as well as the Limit keyword to return a
> certain number of results per page.
> -B
> 

So there is no php code I need to know to get returns
on my query statement ?

Stuart

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



RE: [PHP] Looking for pointers to mysql functions

2004-11-11 Thread Stuart Felenstein

--- Graham Cossey <[EMAIL PROTECTED]> wrote:


> Is this something like what you are after:
> 
>  $sql = "SELECT col1, col2, col3, col4 as colx, col5
> FROM my_table
> WHERE col2 LIKE '%$search%'
> ORDER BY col3
> LIMIT $from, $max_results";
> 
> $result = mysql_query($sql) or die ("Query failed: "
> . mysql_error());
> while($row = mysql_fetch_assoc($result))
> {
> ?>
> 
>   
>   
> 
>  }
> ?>
> 
> For details on how to do the x rows per page with
> previous and next see
> 
> http://www.phpfreaks.com/tutorials/43/0.php
> or
> http://www.phpfreaks.com/tutorials/73/0.php
> 
> HTH
> Graham
> 
Yes, I think this is it.  I appreciate the link to the
rows per page thing!
Very helpful as always!

Stuart

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



Re: [PHP] Re: Help: Database Search

2004-11-12 Thread Stuart Felenstein

--- Sebastian Mendel <[EMAIL PROTECTED]> wrote:
> 
> $where = array();
> 
> if ( isset($_POST['Ind']) ) {
>  $where[] = 'vendorjobs.Industry = ' . (int)
> $_POST['Ind'];
> }
> if ( isset($_POST['Days']) ) {
>  $where[] = 'Date_Sub(Curdate(), interval ' .
> (int) $_POST['Days'] . 
> ' day) <= PostStart';
> }
> 
> $sql = '
>   SELECT ...
> FROM vendorjobs
>WHERE ' . implode( ' AND ', $where );
> 
 
Sebastian, I meant to thank you for this code the
other day.  
What I'm trying to figure out is some of my elements
are arrays themselves.  So for example I have this :

$Ind = "";
$Ind = $HTTP_POST_VARS['Ind'];
if (count($Ind) > 0 AND is_array($Ind)) {
 $Ind = "'".implode("','", $Ind)."'";
}

So how would this code , or array get into what you
stated as:

> $where = array();
> 
> if ( isset($_POST['Ind']) ) {
>  $where[] = 'vendorjobs.Industry = ' . (int)
> $_POST['Ind'];
> }

I guess that is putting an array into an array ?
Not quite sure how the loop would go.

Thank you,
Stuart

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



RE: [PHP] Re: Help: Database Search

2004-11-12 Thread Stuart Felenstein

--- Graham Cossey <[EMAIL PROTECTED]> wrote:

> This should result in:
> 
> WHERE vendorjobs.Industry IN (2,3,5)
> 
> OR
> 
> WHERE vendorjobs.Industry = 2
> 
> HTH
> Graham

Not sure what you mean by the above ?

Stuart

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



[PHP] What am I doing wrong - PHP

2004-11-12 Thread Stuart Felenstein
Ok, hopefully I can explain this clearly, even though
I think I might be an idiot since Ive been going on
about this for a few days.

I have a table that holds values and labels 
i.e. 1 = New York
 2 = Boston
 3 = Kansas City
 4 = Amsterdam

I want to put this table into a multiple selection
list, that a user can choose from in a form
My code is drawing a blank though:

//This is my call to the table "staindtypes"



//Here is the element and the php to loop it

  
  Please Select


 0) {
  mysql_data_seek($inds, 0);
  $rows = mysql_fetch_assoc($inds);
  }
 ?>

When I load the page it is blank.

Any help would be appreciated.

Stuart

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



Re: [PHP] Re: What am I doing wrong - PHP

2004-11-13 Thread Stuart Felenstein

--- "M. Sokolewicz" <[EMAIL PROTECTED]> wrote:
> I would suggest writing it like this:
[snip]

I'm getting the page now with the "box" but no values
inside.  Database conn is fine and all.  I can print
out the value , just can't get them to show up inside
form  element (Multiple select)

Here is what I have 
Again, StaIndTypes is made up of CareerIDs [int] and
CareerCategories [varchar]





  
'.$inds['CareerCategories'].'';
}
echo '';


Thanks 
Stuart

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



Re: [PHP] Re: What am I doing wrong - PHP

2004-11-13 Thread Stuart Felenstein

--- Jason Wong <[EMAIL PROTECTED]> wrote:


> $row is what contains the data you're grabbing from
> the DB and you're not 
> using it
> 
> Jason Wong -> Gremlins Associates ->


Thank you Jason, its working now !


Stuart

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



RE: [PHP] Re: Help: Database Search

2004-11-13 Thread Stuart Felenstein
I think I'm almost there :)
Only right now I'm getting an error message:

"Query failed: You have an error in your SQL syntax.
Check the manual that corresponds to your MySQL server
version for the right syntax to use near '' at line 3"

 1)
  {
$IndStr = implode("','", $Ind);
$where[] = "VendorJobs.Industry IN($IndStr)";
  }else{
$where[] = "VendorJobs.Industry = {$Ind[0]}";
}
?>
http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: Help: Database Search

2004-11-13 Thread Stuart Felenstein
Sorry, I fixed Ind , since the element is named Ind[].
Now I get a different error:

Query failed: You have an error in your SQL syntax.
Check the manual that corresponds to your MySQL server
version for the right syntax to use near
'','','Array)' at line 3
 
>  $where = array();
> $Ind[] = "";
> $Ind[] = $_POST['Ind'];
>   if (count($Ind) > 1)
>   {
> $IndStr = implode("','", $Ind);
> $where[] = "VendorJobs.Industry IN($IndStr)";
>   }else{
> $where[] = "VendorJobs.Industry = {$Ind[0]}";
> }
> ?>
>  $sql = 'SELECT PostStart, JobTitle, Industry,
> LocationState, VendorID
> FROM VendorJobs
> WHERE ' . implode( ' AND ', $where );
> 
> $result = mysql_query($sql) or die ("Query failed: "
> .mysql_error());
> while($row = mysql_fetch_assoc($result))
> 
> I can't find the problem.
> Anyone see anything ?
> 
> Thank you.
> Stuart
> 
> -- 
> 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



Re: [PHP] Re: Help: Database Search

2004-11-13 Thread Stuart Felenstein

--- Jason Wong <[EMAIL PROTECTED]> wrote:
 
> Uhmm, you could try some debugging of your own
> instead of relying on the list. 
> Liberally douse your code with print_r() and
> var_dump() of all your important 
> variables. Do they contain what you expected? If not
> try and figure out why 
> not.
> 
> -- 
> Jason Wong -> Gremlins Associates ->

Okay, took your advice, but it seems to be a sql error
as the message says.  

Stuart

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



Re: [PHP] Re: Help: Database Search

2004-11-13 Thread Stuart Felenstein

--- Jason Wong <[EMAIL PROTECTED]> wrote:
> Yes, that was apparent from your previous post. So
> did you print out your 
> query and examine it for any obvious mistakes? And
> if you couldn't spot any 
> obvious mistakes then the least you could have done
> was to copy and paste the 
> full query in your post so that we could see it in
> all its glory instead of 
> the truncated query that was posted as part of the
> mysql error message. 
> Please help us to help you.
> 
> -- 
> Jason Wong -> Gremlins Associates ->

It was not apparent whatsoever.  Let me show the code
again , but I'll include the print_r returns inline
code.

 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5
[5] => 6 [6] => 7 [7] => 8 [8] => 9 [9] => 10 [10] =>
11 [11] => 12 [12] => 13 [13] => 14 [14] => 15 [15] =>
16 [16] => 17 [17] => 18 [18] => 19 [19] => 20 [20] =>
21 [21] => 22 [22] => 23 [23] => 24 [24] => 25 [25] =>
26 [26] => 27 [27] => 28 [28] => 35 [29] => [30] =>
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5
[5] => 6 [6] => 7 [7] => 8 [8] => 9 [9] => 10 [10] =>
11 [11] => 12 [12] => 13 [13] => 14 [14] => 15 [15] =>
16 [16] => 17 [17] => 18 [18] => 19 [19] => 20 [20] =>
21 [21] => 22 [22] => 23 [23] => 24 [24] => 25 [25] =>
26 [26] => 27 [27] => 28 [28] => 35 ) )
So maybe this is weird, since it seems to print out
twice ?


  if (count($Ind) > 0)
  {
$IndStr = implode("','", $Ind);
$where[] = "VendorJobs.Industry IN($IndStr)";
  }else{
$where[] = "VendorJobs.Industry = {$Ind[0]}";
}
?>

 VendorJobs.Industry
IN(1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','35','','Array)
)

$result = mysql_query($sql) or die ("Query failed: "
.mysql_error());
while($row = mysql_fetch_assoc($result))
?>

Stuart

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



Re: [PHP] Re: Help: Database Search

2004-11-13 Thread Stuart Felenstein

--- Jason Wong <[EMAIL PROTECTED]> wrote:
 
> See the "Array" (also missing a single-quote),
> that's element [30] mentioned 
> above.
> 
> Summary: the missing single-quotes are the
> show-stopper.
> 
I see that , but I'm not sure how that is happening. 

Here is the sql:

$sql = 'SELECT PostStart, JobTitle, Industry,
LocationState, VendorID
FROM VendorJobs
WHERE ' . implode( ' AND ', $where );
// Is it the Where statement maybe ?

//print_r($where);

$result = mysql_query($sql) or die ("Query failed: "
.mysql_error());
while($row = mysql_fetch_assoc($result))

Stuart

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



Re: [PHP] Re: Help: Database Search

2004-11-13 Thread Stuart Felenstein

--- James Kaufman <[EMAIL PROTECTED]>
wrote:


> Right here, print the contents of $sql. That is the
> most important thing to
> know right now.
> 

SELECT PostStart, JobTitle, Industry, LocationState,
VendorID FROM VendorJobs WHERE VendorJobs.Industry
IN(1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','Array)Query
failed: You have an error in your SQL syntax. Check
the manual that corresponds to your MySQL server
version for the right syntax to use near
'','2','3','4','5','6','7','8','9','10','11','12','13','14','15'


Looks like the array is matching ?

Stuart

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



Re: [PHP] Help: Database Search

2004-11-13 Thread Stuart Felenstein
I've changed my logic around but still running into a
sql query error.
I've tried a number of things with no success.  Here
is the error that returns on POST:

SELECT PostStart, JobTitle, Industry, LocationState,
VendorID FROM VendorJobs WHERE (VendorJobs.Industry =
''1','2','3''Query failed: You have an error in your
SQL syntax. Check the manual that corresponds to your
MySQL server version for the right syntax to use near
'1','2','3''' at line 2 . 

Here is the relevant code:

$Ind = $HTTP_POST_VARS['Ind'];
if (count($Ind) > 0 AND is_array($Ind)) {
$Ind = "'".implode("','", $Ind)."'";
}
$sql = "SELECT PostStart, JobTitle, Industry,
LocationState, VendorID
FROM VendorJobs";
//if ($Ind)
$sql .= " WHERE (VendorJobs.Industry = '$Ind'";

I'm not trying to be a pain here.  Either I'm not
catching a syntax error or something else.

Stuart

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



[PHP] Re:[SOLVED] [PHP] Help: Database Search

2004-11-13 Thread Stuart Felenstein

--- Stuart Felenstein <[EMAIL PROTECTED]> wrote:

Okay, so what did I learn.  

1) That a comma delimited list (from the array) to be
used correctly in the sql statement had to use the IN
word.
$sql .= " WHERE VendorJobs.Industry IN ($s_Ind)";

2) I need a space between the first quotation in the
first and second sql statements. 

3) Debug my code.  Perhaps I need to learn more about
that but i was printing out the sql statements and had
the mysql_error() set for the failure.

Stuart

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



RE: [PHP] Re: Help: Database Search

2004-11-13 Thread Stuart Felenstein
--- Graham Cossey <[EMAIL PROTECTED]> wrote:

> Hi Stuart
> 
> Not sure what's happening with the $Ind variable,
> maybe check the $_POST
> array as you enter the script to ensure that the
> form is passing the data
> correctly. It is almost as if you are appending it
> to itself at some point.
> You don't have a line like this anywhere do you :
> $Ind[] = $Ind;  OR maybe 2
> of: $Ind[] = $_POST['Ind']; ??
> 
> Part of the problem is with the implode statement.
> It is this that is not
> adding the initial and final ' to your IN statement,
> see below:
> 
>   if (count($Ind) > 0)
>   {
> 
> $IndStr = implode("','", $Ind);
> $where[] = "VendorJobs.Industry IN('$IndStr')";
>^---^
>   }else{
> $where[] = "VendorJobs.Industry = {$Ind[0]}";
> }
> 
> I would also remove this line:
> $Ind[] = "";
> 
> HTH
> Graham
> 
I think it's working , at least I get results now with
no error messages.  Still some work to go on the
script.  Here is the current initializatin and sql
code:

$Ind = $HTTP_POST_VARS['Ind'];
if (count($Ind) > 0 AND is_array($Ind)) {
$s_Ind = "'".implode("','", $Ind)."'";
}

I guess here I should put this in braces as it should
be conditional if $Ind is set, if not the subsequent
sql statement shouldn't go in.

if ($Ind) 
$sql .= " WHERE VendorJobs.Industry IN ($s_Ind)";

Stuart

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



[PHP] Database Search and seperate results page

2004-11-14 Thread Stuart Felenstein
After googling for quite some time I'm back asking
here.  I want to be able to seperate by search and
results into two pages.

My form is set up on Search.php
I have set action"searchresults.php"

Couple of questions:
I have my array of user selected options from my form
element - Ind[]

I gather the processing of the array needs to be done
first before posting.  
I tried this:
searchresults.php?Ind=
but all I saw in the searchresults.php url was ..?ind
= 
?

Does the searchresults page need to use the GET method
to gather up the variables?

Thanks
Stuart

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



[PHP] Re:[SOLVED] [PHP] Database Search and seperate results page

2004-11-14 Thread Stuart Felenstein

--- Stuart Felenstein <[EMAIL PROTECTED]> wrote:

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



Re: [PHP] Database Search and seperate results page

2004-11-14 Thread Stuart Felenstein
--- Jason Wong <[EMAIL PROTECTED]> wrote:

> Sadly, you're really not learning much from this
> list ...

I partially disagree.  I think it might be better for
me to take a more elementary approach to the language
before getting moving on to specific project issues. 



> ... print_r()/var_dump() $_POST["Ind[]"], what do
> you see? Nothing I bet. Why? 
> See manual > PHP and HTML for details.
> 

> 
> There are 2 way you can do this:
> 
> a) Pass the individual elements of $_POST['Ind']
> 
> or
> 
> b) serialize() $_POST['Ind'], pass it as a single
> element, then on the 
> receiving page unserialize() it
> 

I posted a few hours prior to your response that this
was solved.  I am using the $_POST method. On the
results page I check to see if there are any elements
set and then move on to implode.  

It's working.  Though I have some other things to
figure out ;)

Stuart

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



Re: [PHP] Post Array elements to URL / was: Database Search .............

2004-11-15 Thread Stuart Felenstein

--- Jason Wong <[EMAIL PROTECTED]> wrote:

> you need to build a string which looks like:
> 
>   Stat[1]=value1&State[2]=value2...&Stat[n]=valuen
> 
> which you append to your URL like so:
> 

searchresults.php?Stat[1]=value1&Stat[2]=value2...&Stat[n]=valuen
> 
> This can be done using a foreach() on $_POST['Ind'],
> and implode(). Remember 
> to validate each item as you go along.


Not sure if this means I need to use both a foreach
and implode or one of them.

Right now I have this :

$val ) {
print "$key = $val";
}
?>
 
I'm wondering how I change from printing it our to
getting into the URL.

Stuart

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



[PHP] Database search logic question

2004-11-15 Thread Stuart Felenstein
For those who recognize this topic from me and perhaps
are sick of it , my apologies :)

This is actually a different question more about logic
then syntax or functionality.

One of the uses of my search form is that users may
save their search parameters. Typical benefits, they
don't have to re-enter all the criteria.  Hitting one
link or receiving an email can get them the results
they need.  

The way I was approaching this was to grab the url,
the part after the ? , so not the referer.  Whatever
the second part is called. 
Only now that I've created a search and results page
via Post method, of course there is nothing going to
the URL. I'm wondering at this point if I should
create a way to let users save their search
parameters, by grabbing the variables and storing them
as an array in the database or go back to the URL
method.

Curious if anyone sees benefits or negatives with
either.

Stuart

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



RE: [PHP] Database search logic question

2004-11-15 Thread Stuart Felenstein
Please see inline:
--- Graham Cossey <[EMAIL PROTECTED]> wrote:

> A couple of possibilities are:
> 
> Store search criteria (form entries) in MySQL
> Store query string in MySQL

So with my current form, the where statement is built
from conditions that are set (or not set) in the form.
Perhaps I grab that one array ?

> On one of my sites I allow users to either build a
> query via a step-by-step procedure or manually enter

> a query
> statement. It is the statement that I store in the 
> database together with a name they supply and their
> user 
> id. This allows the user to save multiple queries
> and 
> recall them at a later date by a name that they
> supplied.
> 
I have something like that set up now.  The user must
be registered and logged in, the difference is I'm
saving the query string from URL. 

Stuart

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



RE: [PHP] Database search logic question

2004-11-15 Thread Stuart Felenstein
See inline:
--- "Chris W. Parker" <[EMAIL PROTECTED]> wrote:

> Stuart Felenstein <mailto:[EMAIL PROTECTED]>
> on Monday, November 15, 2004 1:10 AM said:
> 
> > The way I was approaching this was to grab the
> url,
> > the part after the ? , so not the referer.
> 
> This sounds like you're not familiar with the $_GET
> array. $_GET is
> everything after the ? in the url but as an array.

It sounds like you answered before you either read or
understood.  I was talking about 

$_SERVER["QUERY_STRING"];


> This sounds like you're not familiar with the $_POST
> array. $_POST is
> everything that *would be* after the ? in the url
> but as an array.

In $_POST there is nothing in the URL , there is no ?.


> > I'm wondering at this point if I should
> > create a way to let users save their search
> > parameters, by grabbing the variables and storing
> them
> > as an array in the database or go back to the URL
> > method.
> 
> I don't see how these two things are similar.
> 

They are not similar but will accomplish the same
goal.


> If you want to store your array in a db use
> serialize() and
> unserialize(). In any case I would just store the
> search criteria in a
> cookie and leave the db out of it.

A ccokie wouldn't help me one bit in this situation.  

Stuart
 

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



Re: [PHP] Database search logic question

2004-11-15 Thread Stuart Felenstein
See inline please:
--- David Bevan <[EMAIL PROTECTED]> wrote:

> Did you take the time to think about what you were
> going to do before starting 
> your application? 

Honestly , no I did not.  What I did start out with is
a belief that there wouldn't be a need to know php.  I
was using a RAD, that was sold as all encompassing. 
Fool me once.

> If you are looking to have the SQL query string sent
> as POST vars but don't know how to get those out of 
> the array, I would say you have some RTFMing to 
> do, the same would go for sending the users to your
> results page AND ( you can do both POST and GET vars
> for a single page)adding a querystring to the 
> url so that the user could bookmark the url and have
> a way to return to the same query they specified
> provided that the database query happens on/in the 
> results page.

Ok, I was not aware that both POST and GET can be used
at the same time.  
 
> If that answers any of your questions, great, if
> not, try planning ahead a 
> little instead of asking the list to write the
> functionality code for you.
> 
Okay, so showing me how something works is now wrong ?
No one has shown you code or explained a better method
at some function ?

This particular post has went way passed its course. 
Thank you for your help.

Stuart

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



RE: [PHP] Database search logic question

2004-11-15 Thread Stuart Felenstein

--- "Gryffyn, Trevor" <[EMAIL PROTECTED]>
wrote:


> This is a PHP General mailing list, it should be for
> general, newbie,
> etc sort of questions.  But the expectation is that
> the questions being
> asked were researched some ahead of time as well. 
> Although that's not
> always an option and that needs to be understood as
> well.
> 
> 
> Good luck, Stuart.
> 
> -TG
Thank you Trevor.  Your words will be well heeded. 
Your effort and response is greatly appreciated.  I'm
going to make a better effort going forward before
turning to the list for quick answers.

I've received  many great answers and explanations
here.  All have been appreciated , and I hope used for
the betterment of right now, at least my
understanding.

Stuart

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



[PHP] Question on query string

2004-11-16 Thread Stuart Felenstein
I hope this is a reasonable question:


This is the query string my search page is kicking out
to the results page.  It works fine but curious about
these codes or characters. And I know this maybe
unrelated to PHP, so I'll apologize in advance:
Why is each value preceeded by the %5B%5D ?  I think
the % is for wildcards, but for the life of me can't
figure out what 5B and 5D stand for.

Ind%5B%5D=2&Ind%5B%5D=3&Ind%5B%5D=4&Ind%5B%5D=5..

Thank you 
Stuart

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



Re: [PHP] Question on query string

2004-11-16 Thread Stuart Felenstein
--- Richard Davey <[EMAIL PROTECTED]> wrote:


> Use urldecode() to get them back to "normal" again.

Changed the form action line to this: 

action="searchresults.php?Ind=http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Question on query string

2004-11-16 Thread Stuart Felenstein

--- "Ford, Mike" <[EMAIL PROTECTED]> wrote:
 
> The main problem with the above snippet that I can
> see is that there's very
> unlikely to be such a thing as $_POST["Ind[]"] --
> form fields with
> name="Ind[]" will turn up as an array in
> $_POST["Ind"] ($_POST["Ind"][0],
> $_POST["Ind"][1], etc.).  But the whole snippet
> looks very odd -- why are
> you trying to pass POSTed values as GET variables on
> (I presume) a form
> action??  Can you post a little context to the list
> to give us some idea
> what you're really trying to do.

Mike - 
Not sure what context would be useful.  The form
action is set to $_GET method.  I should have noticed
POST in there but set those urldecodes via Dreamweaver
bindings.  If you know what those are. Originally the
form was $_POST.  Now -  method="get"  
The search.php form really does nothing with the
arrays.  In searchresults.php I am grabbing the
variables like this:

$HTTP_GET_VARS['Ind']
if (count($Ind) > 0 AND is_array($Ind)) {
$s_Ind = "'".implode("','", $Ind)."'";

Stuart

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



Re: [PHP] Question on query string

2004-11-16 Thread Stuart Felenstein
--- Jason Wong <[EMAIL PROTECTED]> wrote:
 
> When you're building a query string then (in
> general) there is no need for 
> urldecode(). On the contrary you want to use
> urlencode(), this is done on the 
> *value* of the individual parameters.
> 
> And about this:  $_POST["Ind[]"], it's obvious you
> haven't absorbed what I 
> said about this particular construct. Please re-read
> my previous post 
> regarding this and try to understand it.

> If the URL on the searchpage was constructed
> properly then on 
> searchresults.php the values passed can be read from
> $_GET directly with no 
> further processing (ie no need for urldecode() and
> other such nonsese) on 
> your part. But remember, you still need to validate
> the data you get from 
> $_GET (and in general from $_POST etc) before you
> use them.
> 
Sorry, for some reason my email is out of synch today.
First the searchresults.php is reading the values
properly.  The queries are running correct-all fields.
 I'm still printing out the sql statement and those
are  without the hex values.

The method is $_GET , search.php is nothing more then
some form elements and fields.  
For searchresults.php (right below) is the way I'm
grabbing everything:

$HTTP_GET_VARS['Ind'];
// check any item is selected
if (count($Ind) > 0 AND is_array($Ind)) {
$s_Ind = "'".implode("','", $Ind)."'";
}
$HTTP_GET_VARS['State'];
// check any item is selected
if (count($State) > 0 AND is_array($State)) {
$s_State = "'".implode("','", $State)."'";
}
$HTTP_GET_VARS['TType'];
// check any item is selected
if (count($TType) > 0 AND is_array($TType)) {
$s_TType = "'".implode("','", $TType)."'";
}

//Textfields / Dropdown
$HTTP_GET_VARS['JTitle'];
$HTTP_GET_VARS['City'];
$HTTP_GET_VARS['Days']; 

I'm not seeing what is incorrect. I did try 
$HTTP_GET_VARS['Ind'] = urldecode('Ind'); (in
searchresults.php) but of course it wasn't imploded
yet.  I don't want to confuse this question or myself
(or anyone) , but maybe I should do the implodes on
search.php ?

Stuart

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




RE: [PHP] Question on query string

2004-11-16 Thread Stuart Felenstein

--- "Chris W. Parker" <[EMAIL PROTECTED]> wrote:

> Did you purposefully ignore my previous email???
> Someone else I think
> mentioned this in another email in this thread also.
> Why are you
> assigning anything to $HTTP_GET_VARS at all? It's
> meant to retrieve
> data.
> 
> // (again) this is how you use urldecode()
> $Ind = urldecode($_GET['Ind']);
> 
Chris I did not ignore your email  I tried using that
code.  A warning came back that urldecode was
expecting a string not an array.  This is why I posted
the followup wondering if I should impode the array
and then assign the urldecode.

Stuart

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



RE: [PHP] Question on query string

2004-11-16 Thread Stuart Felenstein

--- "Ford, Mike" <[EMAIL PROTECTED]> wrote:

> > //Textfields / Dropdown
> > $HTTP_GET_VARS['JTitle'];
> > $HTTP_GET_VARS['City'];
> > $HTTP_GET_VARS['Days']; 
> 
> And thrice ditto.
> 
They looked good, gone now :)

Stuart

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



[PHP] How to $_POST from a grid

2004-11-24 Thread Stuart Felenstein
I have set up a record grid, where the user may see a
list of their "records".  Repeat region, etc.
There is a button next to each record the user may
click to allow them to update the particular record.

This all worked fine with $_GET where I did a link on
the button to send the PrimaryID over. 
Now I'm attempting to use $_POST and not having the
same success.  
I moved the grid into a form and have a submit button
now for the "update" button.
Since the grid only is echos of the recordset fields,
how does it know the correct PrimaryID to send when I
hit the submit button. I'm thinking this is perhaps my
problem.

Can anyone help please
Stuart

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



Re: [PHP] How to $_POST from a grid

2004-11-24 Thread Stuart Felenstein

--- Jason Wong <[EMAIL PROTECTED]> wrote: 
> > Since the grid only is echos of the recordset
> fields,
> > how does it know the correct PrimaryID to send
> when I
> > hit the submit button. I'm thinking this is
> perhaps my
> > problem.
> 
> Hidden fields, or give the submit button a name
> that's based on the primaryID.
> 
Thank you.
Close but not there yet.  I placed the hidden field in
the row with the repeat region on it.  Named it the
same as I did using the $_GET.  Problem is it's only
bringing up the last record returned.  i.e. 5 records
are on the grid.  Which ever one I chose to update,
the 5th record is the one coming up on the update
form.

Stuart

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



RE: [PHP] How to $_POST from a grid

2004-11-24 Thread Stuart Felenstein

--- Jay Blanchard
<[EMAIL PROTECTED]> wrote:

> Without a lick of code or a pointer to the grid on
> the web we would be
> hard pressed to offer solutions or advice. Arrays
> maybe? Hidden form
> fields?
> 
Jay, fine - I thought I could spare you the code but
address what the problem might be.

In the grid, I am posting via $_POST the PrimaryID
via:



Then in the update form: 

if (isset($_POST['JID'])) {
  $PJID = $_POST['JID'];

$query .= sprintf("SELECT * FROM vj_prm WHERE JID =
$PJID

I hope this is a better story ;)

Stuart

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



Re: [PHP] Re: How to $_POST from a grid

2004-11-24 Thread Stuart Felenstein

--- Daniel Schierbeck <[EMAIL PROTECTED]> wrote:


> I'd go with a POST form and a JavaScript
> 
> 
>  
>   onclick="document.grid['hidden'].value='123'" 
> value="foobar" />
> 
> 
Yes , that is exactly what I'm doing but it's
returning only the last record.

So here below is an example of the grid results.  
with $_GET I click on one of the returns under
primaryID, if I choose 1stRecord, 1stRecord comes up
in the update form.  If I choose 3rdRecord, 3rdRecord
come s up in the update form.
With $_POST, and i have a form, tried it around each
record, around the whole grid , doesn't seem to
matter.
Regardless of choosing 1st 2nd or 3rd, 3rd is the one
that comes up in the udpate form.

+--+---+---+--+
|PrimaryID | Field2| Field3| Field3   |
+--+---+---+--+
+--+---+---+--+
|1stRecord | xx| xx| xx   |
+--+---+---+--+
+--+---+---+--+
|2ndRecord | xx| xx| xx   |
+--+---+---+--+
+--+---+---+--+
|3rdRecord | xx| xx| xx   |
+--+---+---+--+

Stuart

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



Re: [PHP] How to $_POST from a grid

2004-11-24 Thread Stuart Felenstein

--- David Bevan <[EMAIL PROTECTED]> wrote:


> Would it be possible to see the code that generates
> the grid?
> Both the php and HTML.
> -- 

I'm preferring not to post the code solely becasue I
don't want to expose all my database fields here. Of
course this may cost me the help I need. 

I'm doing my development in Dreamweaver though the
code is basic.  To get to the grid I'm passing over
the userID  .  Then basic a select statement in the
results grid with a while loop the returns all the
records related to the userID.  

It's just odd - because in Dreamweaver I build the
grid with one table row, place my echo fieldx in each
cell, then create a "repeat region" around the row. 
The repeat region is the while loop.

The behaviour though is different for whatever reason.
  Using a link with GET (paramter in the URL) it
distinguishes each primaryID correctly.  Yet with POST
no. As Jason just posted, yes it has individual submit
buttons, yet they solely return the last record.

Oh well.
Sorry for wasting everyone's time.

Stuart

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



RE: [PHP] How to $_POST from a grid

2004-11-25 Thread Stuart Felenstein

--- Graham Cossey <[EMAIL PROTECTED]> wrote:

> Hi Stuart
> 
> Have you looked at the HTML generated by your PHP
> code?
> Using view source you'll see what values each of
> your 3 forms contains and
> therefore what will be submitted in the POST. My
> guess from one of your
> previous posts is that all 3 forms contain the same
> value in the (hidden) ID
> field. You were getting the value from a class but
> did not appear to be
> passing any kind of index to the class to determine
> which value to return.
> 
> HTH
> Graham
> 
Graham - hope your doing good!
It is 4:25am here but just fixed the problem. 
Solution - I created my standard repeat region around
all fields I want returned.  Within the repeat region
I put a form around the submit button and included the
hidden element as well in the form. So each record
returned has a seperate form around the button.  It
works! Records returned properly.

Stuart

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



[PHP] Date Format error

2004-11-25 Thread Stuart Felenstein
I'm getting a:
Parse error: parse error, unexpected '%' in
/home/mysite/public_html/userpage.php on line 120

 Fields('DATE_FORMAT(LstUpdate,'%m/%d/%Y')');
?>
  Fields('DATE_FORMAT(InitOn,'%m/%d/%Y')');
?>
  Fields('DATE_FORMAT(PostStart,'%m/%d/%Y')');
?>

Using this format /syntax
DATE_FORMAT(PostStart,'%m/%d/%Y')worked in a regular
database query.  Apparently not with echo.  I tried no
', also tried " around them, both produced nothing, no
error but no returned date.
Thank you 
Stuart

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



[PHP] Have I learned nothing .> Foreach()

2004-11-30 Thread Stuart Felenstein
I thought this one was under my control.  Apparently
not.  

I'm getting a "Warning: Invalid argument supplied for
foreach() in /home/mysite/public_html/mypage.php on
line 143

First, I have 3 form elements 
school[]
school[]
school[]

Here is how I initialize the session variable (after
user it's submit): 

$_SESSION['schools'] = $_POST['school'];

Then finally on the transaction page, some pages down
the road:

foreach($_SESSION['schools'] as $school)
{
$query = "INSERT INTO mytable (ProfileID, School)
VALUES ($LID, '$school')";
$res6 = run_query($query);
}

I can't for the life of me find the issue here.

Any pointers / help would be greatly appreciated.

Stuart

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



Re: [PHP] Have I learned nothing .> Foreach()

2004-11-30 Thread Stuart Felenstein

--- Marek Kilimajer <[EMAIL PROTECTED]> wrote:

 
> print_r($_SESSION['schools']); here
> 
> > 
> > Then finally on the transaction page, some pages
> down
> > the road:
> > 
> 
> and also print_r($_SESSION['schools']); here
> 
> > foreach($_SESSION['schools'] as $school)
> > {
 
> What have you find out?
> 
They don't exist.  

Stuart

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



RE: [PHP] Have I learned nothing .> Foreach()

2004-11-30 Thread Stuart Felenstein

--- Graham Cossey <[EMAIL PROTECTED]> wrote:

> You have got session_start(); at the top of each
> script haven't you?

Absolutely,  And the other variables are all working.

> Is the SID being passed down the chain of scripts? 
> Is this done by cookie or url?
> 
cookie -or session. 

Stuart

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



[PHP] RE: [SOLVED][PHP] Have I learned nothing .> Foreach()

2004-11-30 Thread Stuart Felenstein

--- Graham Cossey <[EMAIL PROTECTED]> wrote:

How embarassing. I had a typo 
elements were School
variables were school

Stuart

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



[PHP] Question: Search from , text fields

2004-11-30 Thread Stuart Felenstein
I'm building a search form where users can search for
people by zip code.  Trying to get an opinion here. 
Well maybe more then just one. 

Should I have seperate textfields, say (arbitrary) 3 ,
where they can put in 1 zip code per field.  Or do I
do it with one text field , using delimited entries - 

i.e 20199, 20294, 20599, 20054

Or the one text field with boolean.  

i.e 20199 AND 20294 OR 20599

I'm thinking boolean is the best, but being the
inexperienced lame brain I am , how difficult will it
be ?

by the way, this will be seraching a database field(s)

Alright I await the wisdom of PHP-General

Thank you ,
Stuart

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



[PHP] Differences in arrays

2004-12-02 Thread Stuart Felenstein
I have arrays set up in a user form.  One type is from
a multi-select list. (I'm passing these through a
multi page form as session variables)

The multi select list array code is like this:

To $_POST (going on to next page)I have this:

$_SESSION['industry'] = $_POST['L_Industry'];

Then in the final page where the database insert takes
place:

if ( is_array($_SESSION['industry'] ) ) {
foreach ($_SESSION['industry'] as $p ) {
$query = "INSERT INTO Prof_Industries (ProfID, IndID)
VALUES ('$LID', '$p')";  
 
$res4 = run_query($query);

This seems to work just fine as the printout(echo) :

INSERT INTO Prof_Industries (ProfID, IndID) VALUES
('118', '1')

NOW here is the problem:

I have 3 textfield elements all named school[]

To post those:

$_SESSION['schools'] = $_POST['school'];

Then in preparation for insert:

if ( is_array($_SESSION['schools'] ) ) {
foreach($_SESSION['schools'] as $h) {
$query = "INSERT INTO Prof_Schools (ProfID, School)
VALUES ('$LID', '$h')";
$res6 = run_query($query);
echo $query;
}
}
But here is the problem, it seems if the user didn't
input on all 3 textfields the query fails, because the
array is printing out like this:

INSERT INTO Profiles_Schools (ProfID, School) 
VALUES ('118', 'Baruch')

INSERT INTO Profiles_Schools (ProfID, School) 
VALUES ('118', '')

INSERT INTO Profiles_Schools (ProfID, School) VALUES
('118', '')

So you see there is no value for 2 and 3 as the user
didn't input.  But the array moves through the
elements anyway as the ProfID is assigned in the
query.

1-I guess I need a way to make sure in the foreach
that when the first empty element is reached the loop
dies.

2- Why would the second array behave differently then
the first ?

Stuart
Sorry for the long post. Just wanted to makre sure it
was clear in details.

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



Re: [PHP] Differences in arrays

2004-12-02 Thread Stuart Felenstein
--- Mike Smith <[EMAIL PROTECTED]> wrote:

> How about:
> 
> 
> if ( is_array($_SESSION['schools'] ) ) {
> foreach($_SESSION['schools'] as $h) {
> If($h!=""){ //First added line
> $query = "INSERT INTO Prof_Schools (ProfID, School)
> VALUES ('$LID', '$h')";
> $res6 = run_query($query);
> echo $query;
> } //End added line
>}
> }
Yes, I did that and it works correctly now. I was
tryin g to better understand why the difference in the
behaviour.  

Stuart

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



[PHP] Variables from database

2004-12-05 Thread Stuart Felenstein
I haven't try this yet but wondering if it's possible.
 
Can I do something like this:

select fieldone from table ;

$myvar = $fieldone ?

And more so could I do it with a where clause ?

i.e. select fieldone from table where fieldone = 3

$myvar = $fieldone ?

This is probably a stupid question.  I am also
wondering about syntax.

Thank you,
Stuart

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



[PHP] Question: urldecode

2004-12-09 Thread Stuart Felenstein
In my search page, the url returned comes back with
the ..err I forget what it's called, but query string
looks like this: %5B%5D=3.  I think the %5B and 5D
should be [].

What I think is needed is rawurldecode.  I've looked
through my code and think it belongs somewhere in this
block:

$queryString_rsVJ = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
if (stristr($param, "pageNum_rsVJ") == false && 
stristr($param, "totalRows_rsVJ") == false) {
  array_push($newParams, $param);
}
  }
  if (count($newParams) != 0) {
$queryString_rsVJ = "&" .
htmlentities(implode("&", $newParams));
  }
}

would doing something like this make sense?:

$queryString_rsVJ = "&" .
htmlentities(rawurldecode(implode("&", $newParams)));

Feedback appreciated.

Thank you 
Stuart

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



RE: [PHP] Question: urldecode

2004-12-09 Thread Stuart Felenstein

--- "Ford, Mike" <[EMAIL PROTECTED]> wrote:

> Are you seeing the URL-encoded version *only* in
> your browser's
> Address/Location bar?  If so, that's perfectly
> normal and nothing to worry
> about -- it should be automatically decoded by the
> Web server before being
> passed to PHP.

> 
> If you're seeing the encoded version actually in
> your PHP script, that
> sounds like a major problem, possibly indicating a
> missing urldecode() or
> extraneous urlencode() -- in which case, please post
> a more detailed
> analysis of your problem, examples of the unwanted
> behaviour, and the
> relevant portions of script.
> 
I have no idea about what it means to see the encoded
version in my script. I have only one urldecode in the
script:



No urlencodes anywhere. 
I'll assume it's decoded properly before going to php
because the script runs fine.  I just know that I've
seen the hex's normally converted in the browser bar.

Further, I was assuming I should add the urldecode to
the query string.  As I had posted originally.  From
the example in the manual it appears I might to pass
the params through a urldecode counter loop.  

Lastly, I wasn't concerned about the hex code, but I
just made some reconnections of scripts.  Users can
save their search parameters.  I am saving the query
string.  Now I had this set up before and the way it
"was" working , is when the user wanted to view or
edit their saved searches, the search page would come
back with all the parameters filled in including
shaded parameters in things like mult select lists and
menu dropdowns.  It's not working that way now , so my
first suspicion is perhaps the hex is effecting it.

I can post more of the script if that makes sense.

Stuart

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



RE: [PHP] Question:maybe urldecode

2004-12-09 Thread Stuart Felenstein

--- "Ford, Mike" <[EMAIL PROTECTED]> wrote:

> > Lastly, I wasn't concerned about the hex code, but
> I just made some reconnections of scripts.  Users
> can save their search parameters.  I am saving the
> query string.  Now I had this set up before and the 
> way it "was" working , is when the user wanted to   
> view or edit their saved searches, the search page  
> would come back with all the parameters filled in   
> including shaded parameters in things like multi
> select lists and menu dropdowns.  It's not working  
> that way now so my first suspicion is perhaps the
hex > is effecting it.


I'm not sure if this particular is a matter of
debugging.  There is a different behaviour going on
and now I'm not sure if it would have anything to with
the hex.  The textfields in the query string are just
the variable name = value.  

Basically I'm throwing this out though since I'm
wondering if there is something that should be in the
search script , that when I apply a query string to it
would fill in the field (like magic hands)

As an example, if you click on the link , you'll see
industry has 2 choices selected , and city has a
value.
Now I can't reproduce this with my new script.

http://www.lurkingforwork.com/LFWSearch.php?s_Industry[]=2&s_Industry[]=3&s_LocationCity=Bronx&s_JobTitle=&s_PostStart=&VendorJobsPageSize=


Stuart

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



Re: [PHP] Question:maybe urldecode

2004-12-09 Thread Stuart Felenstein

--- Jason Wong <[EMAIL PROTECTED]> wrote:

> > Basically I'm throwing this out though since I'm
> > wondering if there is something that should be in
> the
> > search script , that when I apply a query string
> to it
> > would fill in the field (like magic hands)
> 
> Yeah I wish I had some magic hands that writes my
> programs for me too. 
> Sadly ...
> 
Jason, I don't think you read or understood my
question. As I said, it doesn't seem to be a debugging
scenario.I was asking if anyone would know a
reason why on one page , one could apply the query 
string to  url and the page would be filled in and
another page it doesnt work.  Please don't imply I'm
looking for someone to write my programs. The magic
hands was a reference to how the boxes are filled in
by placing the string in.

Stuart  

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



RE: [PHP] Question:maybe urldecode

2004-12-09 Thread Stuart Felenstein

--- Richard Lynch <[EMAIL PROTECTED]> wrote:

> Then your new script is broken, as clearly the GET
> paramters *ARE* there.

Sorry, I'm not following you.  Where are my GET
parameters ?  The way I've built my present script is
the reults page is grabbing the parameters.  Do I need
to set up GET parameters in the first/search page ?

> 
> Is the new script on a different server or in a
> different directory? 
> Perhaps with register_globals turned OFF?
> 
No , same server, The new scripts are in a different
directory then the previous one. They are not related
or call to each other.Register_globals are set to ON.

Stuart

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



RE: [PHP] Question:maybe urldecode

2004-12-09 Thread Stuart Felenstein

> --- Richard Lynch <[EMAIL PROTECTED]> wrote:
> 
> > Then your new script is broken, as clearly the GET
> > paramters *ARE* there.
> 
> Sorry, I'm not following you.  Where are my GET
> parameters ?  The way I've built my present script
> is
> the reults page is grabbing the parameters.  Do I
> need
> to set up GET parameters in the first/search page ?
> 
> > 
> > Is the new script on a different server or in a
> > different directory? 
> > Perhaps with register_globals turned OFF?
> > 
> No , same server, The new scripts are in a different
> directory then the previous one. They are not
> related
> or call to each other.Register_globals are set to
> ON.
> 
I don't mean to drag this out as I have my work cut
out for me. I did want to add a few more factors that
perhaps is preventing this script from doing the
things I want. 

The first search / results form (the one that works):
a: is really proprietary code which is why I want to
dump it
b: It was created as one page and then I broke the
"grid"(results) portion off, so:
c: In the new scripts the search and results were
created seperately and most of the code is in the
results page. 
What I'm saying is in the search form, all that exists
is the form elements themselves and some resultsets
that feed the multi select lists and menu drop downs.

The results page, has the resultset for formulating
the return records, but it also has the query string
code that grabs the parameters explodes and implodes
them.  
I'm wondering if perhaps I need some of this code in
the search page. 

I wouldn't be throwing this out again, as the scripts
"work", but it's that I need to get the query string
back into the search form and have it display the
parameters there.  I don't even know if that is a
standard function of search pages.  I've done some
googling but have not come up with something that
addresses this type of functionality.

Stuart

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



RE: [PHP] Question:maybe urldecode

2004-12-10 Thread Stuart Felenstein

--- "Ford, Mike" <[EMAIL PROTECTED]> wrote:

> Please, stop giving us vague, generalized
> descriptions of your application,
> and how it is or isn't working "right", and vague,
> generalized descriptions
> of the data it's supposed to be working with. 

I don't believe that the description of my issue was
vague. I provided not only what was expected but an
example.  It's still reasonable to believe that there
could only be a limited number of factors involved as
to what is missing from my script.  

> as it's become increasingly clear
> that you're just flailing
> around in the dark firing buckshot at imagined
> spooks with no real idea of
> what you're doing.

No real idea of what I'm doing ?  

> You might like to start with GET (and POST)
> parameters, as the first
> paragraph quoted above shows that you have no real
> understanding of this
> most basic concept, which is a key topic you must be
> able to comprehend if
> you're using forms.
> 
I understand GET and POST.  
Sorry you feel that way.  Perhaps I have made a pain
of myself on the list.  I'm not really sure what the
requirements of the list are, to ask questions. 
Regardless I must have not met them.  I'll spare you
the trouble of avoiding my posts by not making any.

Thank you,
Stuart

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



RE: [PHP] Forms and viewing Text Area

2004-12-10 Thread Stuart Felenstein

--- "Ford, Mike" <[EMAIL PROTECTED]> wrote:

> echo nl2br(htmlspecialchars($text)) is my usual
> mantra for this.
> 
nl2br will give you back the correct formatting, but
will leave 's in the output.

I just went through this issue the other day, what I
found worked for me was:

htmlspecialchars('string'),ENT_NOQUOTES);
Note- check the available parameters for
htmlspecialchars. I used ENT_NOQUOTES because I wanted
to preserve the single and double quotes in my text.

Hope this helps.

Stuart

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



Re: [PHP] Question:maybe urldecode

2004-12-10 Thread Stuart Felenstein
--- Jason Wong <[EMAIL PROTECTED]> wrote:

> Now in an earlier response I asked you to track your
> variables and see at 
> which point they cease to contain what you expect
> them to contain. Did you do 
> that? If you're not doing *your* part to help solve
> *your* problem then what 
> are you expecting from the list? Some "magic hands"?
> Maybe if you've been a 
> good boy and ask Santa nicely ...
> 
I'm working through this logically, however logic
equates in my universe.  Tracking the variables is
meaningless right now since I haven't set them up in
the search form, outside of naming the form elements. 
When they get passed to the next page (results) they
exist  I've printed out the arrays, the
(SERVER(QUERY_STRING), the resultset, and the array
that is formed from exploding and imploding said
QueryString.

Where I now have done is added this code block into
the search page:


It is not complete obviously. I'm working along the
lines of parsing the query string, and getting the
elements into the correct variables.  I imagine that
is only one way of accomplishing the task.  Once the
string values are parsed into the variables I can then
echo out the values in each form element, aka:

">

Currently to test and work through all of this I have
the search page set to action"". The QueryString
though does return the correct values.

I'm sure none of this makes sense.  

Thank you,
Stuart

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



RE: [PHP] Question:maybe urldecode

2004-12-10 Thread Stuart Felenstein

--- "Ford, Mike" <[EMAIL PROTECTED]> wrote:
 
> AARRGGHHH!  Vague, generalized, woolly!!
> 
> SHOW US the relevant bits of code.  SHOW US what you
> get printed out,
> especially anything that isn't what you expect, and
> tell us exactly what you
> did expect.

> SPECIFICS, man, SPECIFICS!!
> 
> SHOW US the form -- we can't even begin to guess
> what data your script will
> see without knowing what the form says.  Preferably
> tell us *exactly* what
> each control on the form was set to when you
> submitted it.

Each element takes the user input and passes it on to
the results page. What I also  want though it to put
the querystring back into the search page and have the
elements echo out the values chosen.

Let me demonstrate with one element:



'.$row['CareerCategories'].'';
} ?>

Now what I've added: $Ind = $_POST['Ind'];

> 
> > $queryString = ($_SERVER['QUERY_STRING']);
> 
> What is in $queryString after this? var_dump() it
> and show us the result.

This is the var_dump of the query string after I've
made some selections in the page.
string(80)
"Ind%5B%5D=2&Ind%5B%5D=3&Ind%5B%5D=4&JTitle=Web&City=&Days=&Recs=15&Submit=Submit"

> Is it what you expect?  If not, what *did* you
> expect?
Yes, this is what I expect.
 
> What is in $_POST before you start the next batch of
> assignments? var_dump()

Nothing is printing out on $_POST['var'] or $var
s makes sense.

I hope this is clearer with more relevant information.

Stuart 

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



Re: [PHP] Question:maybe urldecode

2004-12-10 Thread Stuart Felenstein

--- Jason Wong <[EMAIL PROTECTED]> wrote:

> > Nothing is printing out on $_POST['var'] or $var
> > s makes sense.
> 
> Now why are you looking in $_POST for your form
> values? They're in $_GET. You 
> said earlier that you understood POST and GET?

I made the correction , using $_GET now.  Values are
printing out, aside from the select lists (arrays)
which print out as "array".

Now I can get the correct values into the text fields,
so they are working, but the drop downs and the select
lists are not.   

I'm not sure, if I need to parse the
(Server(QueryString) or implode the arrays ?This is
the big question for me.

Here is all the relevant code. Perhaps someone can see
what it is I'm doing wrong:

?>



'.$row['CareerCategories'].'';


'.$row['States'].'


'.$row['TaxTerm'].'';





Please Select
'.$row['Days'].'';

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



Re: [PHP] Question:maybe urldecode

2004-12-11 Thread Stuart Felenstein

--- Richard Lynch <[EMAIL PROTECTED]> wrote:

> > I made the correction , using $_GET now.  Values
> are
> > printing out, aside from the select lists (arrays)
> > which print out as "array".
> 
> Yes.
> 
> An array will print as "Array"
> 
> You'll need to dig into the Array for what you need,
> or implode it, or
> something.
> 
I'm imploding the arrays and the correct values are
returned.  Still this is what I'm struggling with:

If I put this querystring back into the url:

http://www.lurkingforwork.com/myownsearch.php?Ind[]=1&JTitle=&City=Winchester&Days=&Recs=15&Submit=Submit

The "textfield" City is repopulate with the value -
Winchester.
The select list Ind[] though is not.  

I thought perhaps I need to do a loop for the Ind[]
value, so I tried this:



I was wrong there as well.  
Just to repeat.  I want to take the query string
created from the user's choices / search parameters
and repopulate the form by applying the querystring on
the form.  www.mysite.com/search?"querystring".

Does this make sense ? Am I being clear in what I'm
asking ?

Stuart

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



[PHP] Question: Repopulating form parameters

2004-12-11 Thread Stuart Felenstein
I'm hoping that this question will be more succinct.
I am trying to repopulate a search form with a user's
chosen paramters.  I am running into a problem with
"multiple select lists"

First , this is the element when the form is first
presented to the user:


'.$row['CareerCategories'].'';
}
?>

So the element's option are taken from a table. 

Now I am grabbing the array and can print out the
chosen values correctly, either using an implode:

if (count($Ind) > 0 AND is_array($Ind)) {
$Ind = "'".implode("','", $Ind)."'";
}

or a "for" loop:

if (isset($Ind)) {
$j = count($Ind);
for($i=0; $i<$j; $i++)
print_r($Ind[$i]);
}

What I can't do is getting the options that were
chosen to be highlighted in the select list.  
i.e if there are 5 options for user to choose from:
1-Banking 2-Arts 3-I.T. 4-Accounting 5-Retail

And user chooses 1-Banking and 5-Retail, when I
reapply the query string I want those 2 to be
highlighed in the options list.  
It is working fine for textfield.  

?Ind%5B%5D=1&Ind%5B%5D=2&JTitle=&City=Bronx&Days=&Recs=15&Submit=Submit

If I apply the above query string, Bronx will be
populated in the City
Not so, with the Ind[] array.

Anyone know what I am talking about ?

Stuart

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



Re: [PHP] Question: Repopulating form parameters

2004-12-11 Thread Stuart Felenstein
--- [EMAIL PROTECTED] wrote:

> you (just) need to mark the previously chosen items
> as "selected" in 
> the repopulated list. the "highlighting" part is a
> basic html/form 
> issue. i.e., if you have questions on this you
> should look at how, on 
> a simple (html-only) form, an item on a list is
> marked (highlighted) 
> as the default. obviously you have set up your code
> so that you know 
> what's been selected previously and then put out the
> necessary html 
> when you repopulate.
> 
This makes sense, however I'm still spacing out trying
to figure out then where I place the "option value
selected" in this html / php code:


'.$row['CareerCategories'].'
'; ?>

I'm pretty sure I need to loop through the $_Get of
the array.   Not sure , and haven't found anything
that shows this.

Stuart

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



Re: [PHP] Question: Repopulating form parameters

2004-12-12 Thread Stuart Felenstein

--- Jason Wong <[EMAIL PROTECTED]> wrote:

> > Close but no cigar.  Since $Ind is already
> imploded my
> > thinking is it need not be incremented in the echo
> > statement ?
> 
> You tell me, print_r() and var_dump() it before you
> use it and decide whether 
> it is correct.
> 
> One final thing: '$Ind' is not the same as "$Ind".
> 


If I choose 1, 2 , 3 then

print_r($Ind); returns
'1','2','3'
This looks okay.

I'm passed the parsing errors. Semi colon was me
trying to stop parsing errors.  

';
if (!(strcmp($row_rsInd['CareerIDs'], "$Ind")))
{echo "SELECTED";}
echo $row['CareerCategories'].'';

I could not find a difference with '$Ind', or "$Ind",
except I would think '$Ind' is correct, since " "
would be a literal string.

Any more hints ? :)

Stuart

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



Re: [PHP] Question: Repopulating form parameters

2004-12-12 Thread Stuart Felenstein

--- Jason Wong <[EMAIL PROTECTED]> wrote:

> > I'm pretty sure I need to loop through the $_Get
> of
> > the array.   Not sure , and haven't found anything
> > that shows this.
> 
> Yes, you need to reference $_GET to see whether an
> option was selected and 
> change the echo above accordingly.
> 

Still stuck on this one.  I know I'm doing something
wrong and wouldn't mind some correction:

Code now:

if (count($Ind) > 0 AND is_array($Ind)) {
$Ind = "'".implode("','", $Ind)."'";


'.$row['CareerCategories'].'';

}
?>

Stuart

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



Re: [PHP] Question: Repopulating form parameters

2004-12-12 Thread Stuart Felenstein

--- Jason Wong <[EMAIL PROTECTED]> wrote:

> On Sunday 12 December 2004 18:15, Stuart Felenstein
> wrote:
> 
> > Still stuck on this one.  I know I'm doing
> something
> > wrong and wouldn't mind some correction:
> 
> Did you mockup some test HTML in a wysisyg editor as
> suggested?

Yep like this :


>Black
>Blue
>Red
>Orange
>Purple
>Brown
  

Problem is arrays are hanging me up.

> Did you compare the mockup HTML with that produced
> by your code above?

//mockup 
>


//Attempt, problems with parsing errors:


';
if (!(strcmp($row_rsInd['CareerIDs'], '$Ind')));
{echo "SELECTED";}
.$row['CareerCategories'].'';
}


Close but no cigar.  Since $Ind is already imploded my
thinking is it need not be incremented in the echo
statement ?

Stuart

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



Re: [PHP][SOLVED] Question: Repopulating form parameters

2004-12-13 Thread Stuart Felenstein

--- Jason Wong <[EMAIL PROTECTED]> wrote:


> I think will call it a day for this thread.

As I suspected a loop was needed to make this work. 
In the event that there are other idiots, such as
myself, that don't immediately figure out the exact
logic I'll post the code:

//The sql is Adodb syntax:
while(!$rsinds->EOF){
?>
 
Fields('CareerIDs')== $a) {echo
"SELECTED";} } ?>>
Fields('CareerCategories') ?>

 MoveNext();
  }
  $rsinds->MoveFirst();

Stuart

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



RE: [PHP] Question: Repopulating form parameters

2004-12-13 Thread Stuart Felenstein

--- "Ford, Mike" <[EMAIL PROTECTED]> wrote:

> > > If in doubt, print it out (TM)
> > > 
> > >   echo '$Ind', "$Ind", $Ind;
> > > 
> > $Ind
> > '1','2','3','4'
> > '1','2','3','4'
> > 
> > Funny, they are both the same.
> 
> "Both"?  There are three things printed out there,
> so "both" cannot be
> right.  2 of the 3 can be the same, or all of them
> can be the same, but not
> "both".
> 
> Cheers!
> 
> Mike

I thought you were ignoring my posts ?
The issue was the difference between double and single
quotes. 
Stuart

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



Re: [PHP][Kill Thread] Question:maybe urldecode

2004-12-11 Thread Stuart Felenstein

--- Stuart Felenstein <[EMAIL PROTECTED]> wrote:

I am ending this thread. 

Stuart

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


Re: [PHP] Question: Repopulating form parameters

2004-12-12 Thread Stuart Felenstein

--- Jason Wong <[EMAIL PROTECTED]> wrote:

> 
> If in doubt, print it out (TM)
> 
>   echo '$Ind', "$Ind", $Ind;
> 
$Ind
'1','2','3','4'
'1','2','3','4'

Funny, they are both the same.

Stuart

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


Re: [PHP] Question: Repopulating form parameters

2004-12-13 Thread Stuart Felenstein

--- David Robley <[EMAIL PROTECTED]> wrote:

> On Mon, 13 Dec 2004 00:56, Stuart Felenstein wrote:
> 
> > 
> > --- Jason Wong <[EMAIL PROTECTED]> wrote:
> > 
> >> 
> >> If in doubt, print it out (TM)
> >> 
> >>   echo '$Ind', "$Ind", $Ind;
> >> 
> > $Ind
> > '1','2','3','4'
> > '1','2','3','4'
> > 
> > Funny, they are both the same.
> 
> I think you are missing the point Jason was trying
> to make, which is the
> difference between '$Ind' and "$Ind". If you look
> again, you will see that
> those are handled differently.
> 
If you read the post Jason suggested I print out using
both single and double quotes.
Regardless that has very little to do with my
question.

Here is just another variation of my multiple select
list. 
Fields('CareerIDs')== 5) {echo "SELECTED";}
?>>Fields('CareerCategories')?>

Here I was just testing with a specific value.
the line == 5 will set the value "SELECTED" correctly.
 If I put in 5, 6, or '5,','6', etc, I get an error. 
However, I don't believe that line works for multiple
values. What works is still a mystery to me.

Stuart

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


Re: [PHP] Question: Repopulating form parameters

2004-12-13 Thread Stuart Felenstein

--- Jason Wong <[EMAIL PROTECTED]> wrote:

> > Here is just another variation of my multiple
> select
> > list.
> >  > ($rsinds->Fields('CareerIDs')== 5) {echo
> "SELECTED";}
> > ?>> > $rsinds->Fields('CareerCategories')?>
> >
> > Here I was just testing with a specific value.
> > the line == 5 will set the value "SELECTED"
> correctly.
> >  If I put in 5, 6, or '5,','6', etc, I get an
> error.
> > However, I don't believe that line works for
> multiple
> > values. What works is still a mystery to me.
> 
> For heaven's sake, do you even know what the HTML
> *should* look like? Did you 
> construct an example to look at? If you're unable to
> construct your own 
> example just look at someone else's, go find a site
> that has multi-select 
> listboxes with pre-selected values and examine the
> HTML source.
> 
heaven's sake ? bit over dramatic. The code above is
my created html. I've created a number of them, both
from a table and just listing out some options. To
repeat they all work . Yet all seem to have little in
common when the values are dynamic and from an array. 


Stuart

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


[PHP] Question: arrays and form elements

2004-12-30 Thread Stuart Felenstein
Generally, when I set up a form where, for example,
I'll be taking multiple selections from a list I would
set the variable / element name as "myvar[]".  So I
have the brackets [] after the variable name to make
it an array. 

What I want to know is there a way to get around the
use  of this syntax ? If the variable name was just
"myvar" (no brackets) is there a way for me to still
grab all the selections and put them into an array ?

Hope this question is clear.

Thank you
Stuart 

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



[PHP] Simple question: $_POST

2005-01-14 Thread Stuart Felenstein
When using $_POST vars is it required that a form is
used ?

In other words I can create an href link and echo
variable and pick them up using $_GET in the following
page. 

No so with $_POST ?


Stuart

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



RE: [PHP] Simple question: $_POST

2005-01-15 Thread Stuart Felenstein

--- "Ford, Mike" <[EMAIL PROTECTED]> wrote:

> To view the terms under which this email is
> distributed, please go to
> http://disclaimer.leedsmet.ac.uk/email.htm
> 
> 
> 
> > -----Original Message-
> > From: Stuart Felenstein
> > Sent: 14/01/05 13:48
> > 
> > When using $_POST vars is it required that a form
> is
> > used ?
> > 
> > In other words I can create an href link and echo
> > variable and pick them up using $_GET in the
> following
> > page. 
> > 
> > No so with $_POST ?
> 
> Short answer: correct.
> 
> Long answer: well, this being PHP, there's pretty
> much always ways and
> means, e.g. cURL. 
> 
> (I suspect, from the way you've asked the question,
> though, the short answer
> probably suffices! ;)
> 
> Cheers!
> 
> Mike
> 
Yes, the short answer sufficed, though the different
responses were great and appreciated. I did not know
about java alternatives or cURL or other php
extensions.  More alternatives for the future.

Stuart

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



<    1   2