RE: [PHP] Embedding JavaScript into a PHP generated web page

2004-07-25 Thread Ash Young
Are you getting any error message at all or is the JavaScript just failing?

If your receiving a PHP error, are you sure you've escaped all the quotes in
the JavaScript?

-- 
ash young :: http://evoluted.net/

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



RE: [PHP] Question about for

2004-07-25 Thread Ash Young
You could try

for ($i=1;$i11;$i=$i+2)

-- 
ash young :: http://evoluted.net/

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



RE: [PHP] Re: Embedding JavaScript into a PHP generated web page

2004-07-25 Thread Ash Young
I'd suggest putting some new line characters in after the !-- as it will
treat the JavaScript as a comment. 

So just add a new line character at the end of each of the echo statements. 


-- 
ash young :: http://evoluted.net/

-Original Message-
From: Robert Frame [mailto:[EMAIL PROTECTED] 
Sent: 26 July 2004 01:13
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Embedding JavaScript into a PHP generated web page

OK, now I am bewildered again.

Sample Code

?php

echo 'script language=text/javascript'; echo '!-- '; echo 'function
myWindow() { alert(javascript from php)}'; echo '//-- /script'; ? ...
htmlbodyform 
 echo 'input type=submit value=Window name=Window
onclick=myWindow(); ';
/form/body/html

As soon as I hit the button 'Window' I get an ''object expected error.

Any thoughts?
Rob

Robert Frame [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 After I posted this I did some more searching on google and found the 
 following code, which works.

 echo 'EOTscript language=javascriptfunction myWindow(){ 
 alert(javascript from php);}/script';

 I then tried it without the EOT tag and it still worked.  Apparently 
 I
had
 something out of wack, probably a quote.

 Off hand though, can anyone tell me what EOT is?

 Thanks for the help.
 Rob

 Robert Frame [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
  Hi There,
 
  I have a web page with a form that is generated by PHP, and part of 
  my design utilizes JavaScript to provide some error checking within 
  the
 objects
  in the form.  I have written the javascript in an html document, but 
  I
am
  having trouble blending the two together.
 
  I have tried sending the javascript within an echo statement, as 
  well as using straight HTML/JavaScript code, but nothing seems to work.
 
  Can anyone offer some help or direct me to a solution?
 
  Thanks,
  Rob

--
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] Looking for a comprehensive PHP tutorial

2004-04-09 Thread Ash..
Hi,

I am looking for a comprehensive handholder tutorial, that introduces the
various aspects
of PHP, step by step and let's u see the big picture.
I have come across tons of PHP learnware which is like how to do this and
how to do that.
But that still doesn't introduce the language to the beginner in an orderly
manner.
Any suggestions, links, will be greatly appreciated.

Or, if someone (experienced in PHP) thinks we must come up with such a
comprehensive tutorial, we can perhaps team up ;)
Ash

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



[PHP] Forwarding to another PHP page

2004-04-09 Thread Ash..
Hello,

Thanks John (Holmes) for the clue on form-param-reading. Simple one, but
shows I got a lot of basics to learn yet.

Here I have another doubt I cant resist asking help for.

What are the various ways of forwarding to another page. I tried header()..
based on an example I found it in, but it doesnt work if I have done an
include before calling the header. What are the other alternatives of
forwarding. (I tried searching the PHP manual, but didnt find any clue. Nor
did I come across any learn material which seemed to deal with this.)
Thanks for all help,
Ash

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



[PHP] Form params not read

2004-04-08 Thread Ash..
Hello,

What I am doing is very simple. I have a form in register.php with several
textboxes and stuff.
On submit, the doRegister.php file is invoked. Now, in that file, I am not
able to successfully retrieve
the parameters filled in the forms (which I need to use to run a db query.)

I checked all syntax and everything seems just as expected in PHP. I tried
both GET and POST.
WHile using GET I can see the parameters in the URL. I am running PHP4 via
Apache 2.0.43.

Can somebody tell me what
could be going wrong?
Thanks,
Ash

Here are the files


register.php

   form method=post action=../controller/doRegister.php
name=register
table width=100% border=0
 tr
  td First Name
   input type=text name=firstName size=30 maxlength=30
  /td
  td Last Name
   input type=text name=lastName size=30 maxlength=30
  /td
 /tr

!-- SNIP --

 tr
  td colspan=2
   div align=center
input type=submit name=register value=Register
   /div
  /td
 /tr
 tr
  td colspan=2nbsp;/td
 /tr
/table
   /form





doRegister.php
--

?php

echo adding 1 [ . $firstName . ]br;

include(../common/opendb.php);


addStuff('ssn03', $firstName, $lastName, $addess1, $address2, $city, $state,
$zip, '123456789', $email, $password);

//header(Location: ../general/home.php);
exit();


function addStuff($SSN, $firstName, $lastName, $address1, $address2, $city,
$state, $zip, $phone, $email, $password)
{
 include(../common/queryList.php);

 echo adding tip 2 ;
 echo [ . $firstName . ]br;

 $query =  INSERT INTO Receiver VALUES ($SSN, $firstName, $lastName,
$address1, $address2, $city, $state, $zip, $phone, $email,  NULL);

 echo query:  . $query . \nbr;

 $result = mysql_query($query) or die (Error in query: $query.  .
mysql_error());


 echo $result;

 // close database connection
 //mysql_close($connection);

 // get and print number of rows in resultset
 //return mysql_num_rows($result);
 //echo \n[ . mysql_num_rows($result) .  rows returned]\n;

}

?





Here is the output I get


adding tip receiver 1 []
adding tip receiver 2 []
query: INSERT INTO Receiver VALUES (ssn03, , , , , , , , 123456789, , NULL)
Error in query: INSERT INTO Receiver VALUES (ssn03, , , , , , , , 123456789,
, ash, NULL). 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 '
, , , , , , 123456789, , NULL)' at line 1

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



[PHP] PHP Apache

2004-01-31 Thread Ash
Hi friends of PHP,
I am new to PHP and just created a code. I tried it out on a php enabled
site and it worked, oh joy!

I then installed apache 2.0.48. All was good.

I then downloaded and installed php 4.3.4.exe, the auto install version. I
chose apache in the bullet menu thing but when it installed it said i have
to configure a file as it failed to work.

I uploaded some PHP files to the htdocs, and loaded it via
http://localhost/file.php. The file exists and it loaded, but wasnt reading
the PHP script? It was like when you just open the file in internet
explorer. I am using inetrnet explorer 6.

Help me, i am running XP Home Edition!

Thanks   Ashley

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



[PHP] The PHP Problem

2004-01-30 Thread Ash
Hi,
I am totally new to PHP and dont know a thing. I tried looking through the
articles but they were of no use. My Question is:
How can I just write php in a text editor, save it as a .php, and view it in
internet explorer, offline? I have tried everything and it just wont work.
I tried the code:

?php
echo Hi, I'm a PHP script!;
?

in a .php file and nothing happened. Nothing will work, help!

I dont have a website, I just want to write and use the code.

Tnaks   from Ashley Williams

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



[PHP] A Problem With Loops

2002-01-10 Thread Ash Young

Hi,

I am having a problem with any type of loop, for, foreach, while. I have a
PHP script that loops through an array that contains the contents of a text
file and processes the data it recieves.

My problem is that the loop will only manage about 18 iterations before
processing dies. I know that PHP scripts on my web host have a max 60sec
execution time but it is not getting anywhere near that time.

Any one have any ideas what I'm doing wrong?



Cheers,

Ash Young


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] A Problem With Loops

2002-01-10 Thread Ash Young

Hi,

Sorry about not showing the code, there is a lot of it. Now this script
works in my pc, running IIS5 but not on my web host.

If you remove various parts of the main if statments then it manages more
than 20. Depending which if statement is removed, changes how many
iterations it will last for. However it will iterate the the correct amount
if it never chooses a if statement. That make sense?

The posted below, sorry there is quite a lot of it in the for loop :)

Cheers,

Ash Young





for($n=3;$ncount($fcontents);$n++) {
/*

*
* FIRST CHECK TO EVALUATE WHAT THE LINE IS.

*
*/
  $pos[MODECHANGE] = strpos($fcontents[$n],**);
  $pos[NOTICE] = strpos($fcontents[$n],-);
  $pos[MESSAGE] = strpos($fcontents[$n],);
  $pos[ACTION] = strpos($fcontents[$n],* );
  $pos[SESSION] = strpos($fcontents[$n],Session);
  $pos[DONTKNOW] = 999;
  if(!is_integer($pos[MODECHANGE]))  $pos[MODECHANGE]=1000;
  if(!is_integer($pos[NOTICE]))  $pos[NOTICE]=1000;
  if(!is_integer($pos[MESSAGE]))  $pos[MESSAGE]=1000;
  if(!is_integer($pos[ACTION]))  $pos[ACTION]=1000;
  if(!is_integer($pos[SESSION]))  $pos[SESSION]=1000;
  asort($pos);reset($pos);
  $key = key($pos);
  if($key==MESSAGE) $mode = MESSAGE;
  elseif($key==MODECHANGE) $mode = MODECHANGE;
  elseif($key==ACTION) $mode = ACTION;
  elseif($key==SESSION) $mode = SESSION;
  elseif($key==NOTICE) $mode = NOTICE;
  elseif($key==DONTKNOW) $mode = DONTKNOW;
/*

*
* NOW EXECUTE THE CODE FOR OUR PARTICULAR ACTION

*
*/

  if($mode==MESSAGE) {
/*

*
* MESSSAGE CODE
* GET NICKNAME, THEN CHECK TO SEE IF EXISTS IN NICK ARRAY IF NOT ADD,
CREATING
* A NEW NICKNAME OBJECT WITH IT.
* ELSE INCREMENT ADD THE LINENO TO THE OBJECT FOR RANDOM LINE PROCESSING

*
*/
$currentnick =
substr($fcontents[$n],$pos[MESSAGE]+1,strpos($fcontents[$n],) -
$pos[MESSAGE]-1);
// See if it exists already in our nicklist array
if (!isset($nicklist)) {
  $nicklist[$currentnick] = new NickName($currentnick,$n,0,0);
}
elseif (@array_key_exists($currentnick, $nicklist)) {
  $nicklist[$currentnick]-addLine($n);
}
else {
  $nicklist[$currentnick] = new NickName($currentnick,$n,0,0);
}
/*

*
* NOW CREATE TIME OF DAY ARRAY

*
*/
$currenthr = substr($fcontents[$n],1,2);
if(is_numeric($currenthr))
  $timeofday[$currenthr]++;
  }
  elseif($mode==MODECHANGE) {
/*

*
* CHANGE MODE CODE
*
* FIRST SEE IF TOPIC LINE

*
*/
$lstart = $pos[MODECHANGE]+4;
if (substr($fcontents[$n],$lstart,5)==Topic) {
/*

*
* DEAL WITH TOPIC ON JOIN, ADD TO TOPIC ARRAY, THEN WITH TOPIC CHANGE

*
*/
  $prevtopics[] =
substr($fcontents[$n],$lstart+10,strlen($fcontents[$n])-$lstart-13);
}
elseif(strpos($fcontents[$n],changes topic)  NULL) {
  $temppos = strpos($fcontents[$n],changes topic)+18;
  $prevtopics[] =
substr($fcontents[$n],$temppos,strlen($fcontents[$n])-$temppos-2);
}
  }
  elseif($mode==ACTION) {
/*

*
* ACTION CODE
* GET NICKNAME, THEN CHECK TO SEE IF EXISTS IN NICK ARRAY IF NOT ADD,
CREATING
* A NEW NICKNAME OBJECT WITH IT.
* ELSE INCREMENT ADD THE LINENO TO THE OBJECT FOR RANDOM LINE PROCESSING

*
*/
$currentnick =
substr($fcontents[$n],$pos[ACTION]+2,strpos(substr_replace($fcontents[$n],
,0,$pos[ACTION]+2), ));
// See if it exists already in our nicklist array
if (!isset($nicklist)) {
  $nicklist[$currentnick] = new NickName($currentnick,0,0,$n);
}
elseif (@array_key_exists($currentnick, $nicklist)) {
  $nicklist[$currentnick]-addAction($n);
}
else {
  $nicklist[$currentnick] = new NickName($currentnick,0,0,$n);
}
  }
  elseif($mode==NOTICE) {
/*

*
* NOTICE CODE
* CHECK IF NOTICE IS ACTUALLY WHOIS. IF SO SKIP THE WHOIS AND CONTINUE
PROCESSING

[PHP] Searching a string or similar

2001-12-28 Thread Ash

Hi i've taken a look throught he manual and i can't find a function to do
this

Basically i want to take in a string and check that the string doesn't
contain a certain word or something

ie check that it doesn't contain SCRIPT LANGUAGE = Javascript to prevent
hackers/crackers on my guestbook


Thanks

Ash




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: concurrent users

2001-12-28 Thread Ash

Jamie Fields [EMAIL PROTECTED] wrote in message
 I have recently been requested to choose new technology to be used within
my
 organization.  My options seem to include PHP and JSP, and I am leaning
 toward PHP.  The one thing I really need to know is how many concurrent
 users PHP can handle at one time.  This project is for an extremely large
 corp and I need to know that PHP can scale at the level that I need it to.
 Thanks in advance.
 Jay Fields

JSP is going to be faster as these objects are all ready created  loaded
(apparantly according to the Sun Micro Systems guy) php however is more
likely to be on a external webserver. Probabily not that much help but
thought i'd put in my 2 pence



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]