[PHP] can this be fone with PHP?

2007-02-22 Thread Bruce Gilbert

I have created forms with PHP where the information in the fields is
sent via sendmail to an email, but is there a way to have the
information extracted and a pdf form created when the user hits the
submit button?

--
::Bruce::

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



[PHP] help with script needed

2007-03-07 Thread Bruce Gilbert

I have a little script that prints a number out from 1 to 100
[php]
";

}
?>
[/php]

I just need to add code to print something different, say "foo" if the
output is a multiple of 5 or 10 for example. How do I go about doing
this?

--
::Bruce::

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



Re: [PHP] help with script needed

2007-03-07 Thread Bruce Gilbert

Thanks for the responses so far.

This is what I have come up with
[php]
";
if ($i%3 == 0) echo "Foo ";
elseif ($i%5 == 0) echo "Bar";
}

?>
[/php]

and the results can be seen here
http://www.inspired-evolution.com/image_test/numbers_output.php

I actually want the Foo and Bar to replace the numbers they are
dereivatives of and not appear below as they are now, and I also need
to add a third condition for "FooBar" which would be for numbers that
are both divisible by 3 and 5.

thanks

On 3/7/07, Martin Marques  wrote:

Tijnema ! escribió:
> On 3/7/07, Bruce Gilbert <[EMAIL PROTECTED]> wrote:
>> I just need to add code to print something different, say "foo" if the
>> output is a multiple of 5 or 10 for example. How do I go about doing
>> this?
>>
>
> I've seen that question a lot, what i use is fairly simple
> if( intval($number / $multiple) == ($number / $multiple ) )
>
> try that

Very bad solution. Try the % operator:

if($number % $multiple == 0)

http://www.php.net/manual/en/language.operators.arithmetic.php

--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-
Martín Marqués  |   Programador, DBA
Centro de Telemática| Administrador
Universidad Nacional
 del Litoral
-




--
::Bruce::

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



[PHP] variables in CSS in PHP question/problems

2007-03-13 Thread Bruce Gilbert

I stumbled upon this article http://www.chrisjdavis.org/2005/10/16/php-in-css/

and was trying out variables with PGP, but can't get it to work. I
wanted to have a variable image that changes on refresh, and also set
the body color with PHP/CSS and maybe get that to change on refresh
too.

sp from the tutorial mentioned above I have:

[php]
fields = array'body','image_float');
*  foreach ($this->fields as $field) {
*   $this->{"$field"} = $args["$field"];
*}
*}
* }
*
**/

function font($args=array()) {
   $this->fields = array('body','image_float');
foreach ($this->fields as $field) {
$this->{"$field"} = $args["$field"];
}
}
}

/**
*
* create our color class.
*
**/

class color {

/**
*
* In PHP 4 your constructor has to have the same name as the class, see above.
*
**/
function color($args=array()) {
   $this->fields = array('body','image_float');
foreach ($this->fields as $field) {
$this->{"$field"} = $args["$field"];
}
}
}

/**
*
* create and setup our color object
*
**/

$color = new color(array(

body => "#000",

));

/**
*
* And now we write our rotation script
*
**/

function rotater() {
// we start off with the path to your images directory
$path='images';

// srand(time()) will generates the random number we need for our rotater
srand(time());
   for ($i=0; $i < 1; $i++) {

// here we are assigning our random number to a variable name so we
can call it later.  An important note here, you see we are dividing
rand() by 6, 6 is the number of images you have to work with, so if
you have 10, we would: rand()%10)
$random = (rand()%6);

// so our files in our images folder are named side_image1.gif,
side_image2.gif, side_image3.gif etc.  We construct the file name once
we have the random number:
$file = 'image_float';
$image = $path . $file . $random . '.gif';
}

//  echo $image here in the function,
}
?>
[/php]

In the XHTML I have:

 
and of course a  tag.

in my css I have:

div.image_float{
background-image: url() no-repeat;
float:left;
width:75px;
height:75px;
padding:15px;
}

and also

body
{

background-color: body; ?>;
}

in my directory, I have a folder called images which is at the root
level with the index file and css, and the images are called
side_image1, side_image2, side_image3 etc.

can anyone see whay this isn't working? Neither the background body
color or the rotating image works.

thanks

--
::Bruce::

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



[PHP] displaying image from MySQL DB using HTML/PHP

2007-03-13 Thread Bruce Gilbert

I am having some difficulty getting an image to display on a php that
I have added to MySQL DB.

Here is what I have tried so far

in the MySQL DB I have a table called image_holder and the fields are
id,mimename,filecontents...filecontents field is set to a type of blob
using PHPMyAdmin and I have uploaded the image in MySQL.

In the PHP code I have:

[php]


and in the HTML code



I am probably way off base, so need some help!


--
::Bruce::

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



[PHP] form not submitting inofrmation

2007-03-16 Thread Bruce Gilbert

I have a form on my website, that used to work, but I just realized
that now it doesn't. You don't get any errors, but I am not receiving
an email with the information after the submittal.

The form is located at http://www.inspired-evolution.com/Contact.php

and the PHP is:

[php]
\n";  // your email client
will show the person's email address like normal
$headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; // sets
the mime type
$recipient = "[EMAIL PROTECTED]";

$subject = "Contact From $site_name - $subject"; // this is the
subject of the email

$msg = wordwrap( $msg, 1024 );



mail($recipient, $subject, stripslashes($msg), $headers); // the
mail() function sends the message to you

// if everything is OK, print a thanks message
print(" Hola $name, Thanks for getting in touch!
We have received your e-mail and will respond at
$flizzum_flazzum");

exit;
}
}
?>
[/php]

emailval.php is

[php]
 and check the length
   $tld = $Levels[$sLevels-1];
   $tld = ereg_replace("[>)}]$|]$", "", $tld);
   if (strlen($tld) < 2 || strlen($tld) > 3 && $tld != "arpa") $fail = 1;

   $Level--;

//  If the string after the last dot isn't in the generic TLDs or
country codes, it's invalid.
   if ($Level && !$fail) {
   $Level--;
   if (!ereg($tld.":", $gTLDs) && !ereg($tld.":", $CCs)) $fail = 2;
   }

//  If it's a country code, check for a country TLD; add on the domain name.
   if ($Level && !$fail) {
   $cd = $sLevels - 2; $domain = $Levels[$cd].".".$tld;
   if (ereg($Levels[$cd].":", $cTLDs)) { $cd--; $domain =
$Levels[$cd].".".$domain; }
   }

//  See if there's an MX record for the domain
   if ($Level && !$fail) {
   $Level--;
   if (!getmxrr($domain, $mxhosts, $weight)) $fail = 3;
   }

//  Attempt to connect to port 25 on an MX host
   if ($Level && !$fail) {
   $Level--;
   while (!$sh && list($nul, $mxhost) = each($mxhosts))
 $sh = fsockopen($mxhost, 25);
   if (!$sh) $fail = 4;
   }

//  See if anyone answers
   if ($Level && !$fail) {
   $Level--;
   set_socket_blocking($sh, false);
   $out = ""; $t = 0;
   while ($t++ < $Timeout && !$out)
 $out = fgets($sh, 256);
   if (!ereg("^220", $out)) $fail = 5;
   }

   if ($sh) fclose($sh);

   return $fail;
 } // End E-Mail Validation Function

?>
[/php]

anyone see what might be causing the problem?

--
::Bruce::

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



[PHP] converting video formats

2007-03-26 Thread Bruce Gilbert

Can someoune point me in the right direction as to how (if possible)
to convert a video format uploaded to a server to a flash format
(.flv) no matter what the orginal format is?

thanks

--
::Bruce::

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



[PHP] determining time difference between two timestamp fields.

2010-05-25 Thread Bruce Gilbert
Here is the situation. I have a form which sets a timestamp when a
user logs in using UPDATE in SQL. The field is called
'login_timestamp' and is in a table called 'Candidates'. I have
another timestamp which is set when a user submits the form data into
the DB and it is called 'submit_timestamp' . What I want to do is
determine the amount of time the user takes to complete the form by
subtracting the 'login_timestamp' time form the 'submit_timestamp'
time. I am using SQL to extract the data here.

$sql = "SELECT Responses.name,Answers,submit_timestamp,login_timestamp
   FROM Responses LEFT JOIN Candidates USING (user_id)";

and then to display the timestamp in readable form.

echo "Completion Time:" . date('F j, Y
g:i:sa', strtotime($row["login_timestamp"])) . "";

so I need to know how to subtract from two timestamp fields, two
different tables and come up with the difference in minutes.


thanks.

-- 
::Bruce::

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



Re: [PHP] determining time difference between two timestamp fields.

2010-05-25 Thread Bruce Gilbert
Thanks. I know my syntax isn't quite right, but is this close to what
I need to do?

echo "Completion Time:" . date('F j, Y
g:i:sa', strtotime($row["login_timestamp"] - ["submit_timestamp"])/60)
. "";



On Tue, May 25, 2010 at 10:01 AM, Peter Lind  wrote:
> On 25 May 2010 15:55, Bruce Gilbert  wrote:
>> Here is the situation. I have a form which sets a timestamp when a
>> user logs in using UPDATE in SQL. The field is called
>> 'login_timestamp' and is in a table called 'Candidates'. I have
>> another timestamp which is set when a user submits the form data into
>> the DB and it is called 'submit_timestamp' . What I want to do is
>> determine the amount of time the user takes to complete the form by
>> subtracting the 'login_timestamp' time form the 'submit_timestamp'
>> time. I am using SQL to extract the data here.
>>
>> $sql = "SELECT Responses.name,Answers,submit_timestamp,login_timestamp
>>           FROM Responses LEFT JOIN Candidates USING (user_id)";
>>
>> and then to display the timestamp in readable form.
>>
>> echo "Completion Time:" . date('F j, Y
>> g:i:sa', strtotime($row["login_timestamp"])) . "";
>>
>> so I need to know how to subtract from two timestamp fields, two
>> different tables and come up with the difference in minutes.
>>
>
> In case you're using MySQL, timediff can do the job:
> http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_timediff
>
> Otherwise, just do strtotime(endtime) - strtotime(starttime) / 60.
> That's the difference in minutes.
>
> Regards
> Peter
>
>
> --
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> BeWelcome/Couchsurfing: Fake51
> Twitter: http://twitter.com/kafe15
> 
>



-- 
::Bruce::

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



Re: [PHP] determining time difference between two timestamp fields.

2010-05-25 Thread Bruce Gilbert
Here is what I currently have.

echo "Completion Time:" .
(strtotime($row['submit_timestamp']) -
strtotime($row['login_timestamp']))/60 , "";

this gives me an output of 21235172.75

not sure what format that is in? I was hoping for something like 60
minutes, 30 minutes etc. Don't need the days or seconds. The MySQL
timestamp is in this format.

2010-05-17 11:32:45 - 2010-05-17 12:26:13

On Tue, May 25, 2010 at 11:11 AM, Peter Lind  wrote:
> On 25 May 2010 16:14, Bruce Gilbert  wrote:
>> Thanks. I know my syntax isn't quite right, but is this close to what
>> I need to do?
>>
>> echo "Completion Time:" . date('F j, Y
>> g:i:sa', strtotime($row["login_timestamp"] - ["submit_timestamp"])/60)
>> . "";
>>
>
> No. Assuming that your timestamp is of the -mm-dd HH:ii:ss form,
> you need to do (strtotime(["submit_timestamp"]) -
> strtotime($row["login_timestamp"]))/60.
>
> Regards
> Peter
>
>>
>> On Tue, May 25, 2010 at 10:01 AM, Peter Lind  wrote:
>>> On 25 May 2010 15:55, Bruce Gilbert  wrote:
>>>> Here is the situation. I have a form which sets a timestamp when a
>>>> user logs in using UPDATE in SQL. The field is called
>>>> 'login_timestamp' and is in a table called 'Candidates'. I have
>>>> another timestamp which is set when a user submits the form data into
>>>> the DB and it is called 'submit_timestamp' . What I want to do is
>>>> determine the amount of time the user takes to complete the form by
>>>> subtracting the 'login_timestamp' time form the 'submit_timestamp'
>>>> time. I am using SQL to extract the data here.
>>>>
>>>> $sql = "SELECT Responses.name,Answers,submit_timestamp,login_timestamp
>>>>           FROM Responses LEFT JOIN Candidates USING (user_id)";
>>>>
>>>> and then to display the timestamp in readable form.
>>>>
>>>> echo "Completion Time:" . date('F j, Y
>>>> g:i:sa', strtotime($row["login_timestamp"])) . "";
>>>>
>>>> so I need to know how to subtract from two timestamp fields, two
>>>> different tables and come up with the difference in minutes.
>>>>
>>>
>>> In case you're using MySQL, timediff can do the job:
>>> http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_timediff
>>>
>>> Otherwise, just do strtotime(endtime) - strtotime(starttime) / 60.
>>> That's the difference in minutes.
>>>
>>> Regards
>>> Peter
>>>
>>>
>>> --
>>> 
>>> WWW: http://plphp.dk / http://plind.dk
>>> LinkedIn: http://www.linkedin.com/in/plind
>>> BeWelcome/Couchsurfing: Fake51
>>> Twitter: http://twitter.com/kafe15
>>> 
>>>
>>
>>
>>
>> --
>> ::Bruce::
>>
>
>
>
> --
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> BeWelcome/Couchsurfing: Fake51
> Twitter: http://twitter.com/kafe15
> 
>



-- 
::Bruce::

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



Re: [PHP] determining time difference between two timestamp fields.

2010-05-25 Thread Bruce Gilbert
probably not fully understanding what I need to do.

I am trying this.

echo "Completion Time:". date('F j, Y
g:i:sa',strtotime($row['submit_timestamp']) -
strtotime($row['login_timestamp']))/60 , "";


but just returns a zero value.


On Tue, May 25, 2010 at 12:55 PM, Ashley Sheridan
wrote:

>  On Tue, 2010-05-25 at 12:46 -0400, Bruce Gilbert wrote:
>
> Here is what I currently have.
>
> echo "Completion Time:" .
> (strtotime($row['submit_timestamp']) -
> strtotime($row['login_timestamp']))/60 , "";
>
> this gives me an output of 21235172.75
>
> not sure what format that is in? I was hoping for something like 60
> minutes, 30 minutes etc. Don't need the days or seconds. The MySQL
> timestamp is in this format.
>
> 2010-05-17 11:32:45 - 2010-05-17 12:26:13
>
> On Tue, May 25, 2010 at 11:11 AM, Peter Lind  wrote:
> > On 25 May 2010 16:14, Bruce Gilbert  wrote:
> >> Thanks. I know my syntax isn't quite right, but is this close to what
> >> I need to do?
> >>
> >> echo "Completion Time:" . date('F j, Y
> >> g:i:sa', strtotime($row["login_timestamp"] - ["submit_timestamp"])/60)
> >> . "";
> >>
> >
> > No. Assuming that your timestamp is of the -mm-dd HH:ii:ss form,
> > you need to do (strtotime(["submit_timestamp"]) -
> > strtotime($row["login_timestamp"]))/60.
> >
> > Regards
> > Peter
> >
> >>
> >> On Tue, May 25, 2010 at 10:01 AM, Peter Lind  
> >> wrote:
> >>> On 25 May 2010 15:55, Bruce Gilbert  wrote:
> >>>> Here is the situation. I have a form which sets a timestamp when a
> >>>> user logs in using UPDATE in SQL. The field is called
> >>>> 'login_timestamp' and is in a table called 'Candidates'. I have
> >>>> another timestamp which is set when a user submits the form data into
> >>>> the DB and it is called 'submit_timestamp' . What I want to do is
> >>>> determine the amount of time the user takes to complete the form by
> >>>> subtracting the 'login_timestamp' time form the 'submit_timestamp'
> >>>> time. I am using SQL to extract the data here.
> >>>>
> >>>> $sql = "SELECT Responses.name,Answers,submit_timestamp,login_timestamp
> >>>>   FROM Responses LEFT JOIN Candidates USING (user_id)";
> >>>>
> >>>> and then to display the timestamp in readable form.
> >>>>
> >>>> echo "Completion Time:" . date('F j, Y
> >>>> g:i:sa', strtotime($row["login_timestamp"])) . "";
> >>>>
> >>>> so I need to know how to subtract from two timestamp fields, two
> >>>> different tables and come up with the difference in minutes.
> >>>>
> >>>
> >>> In case you're using MySQL, timediff can do the job:
> >>> http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_timediff
> >>>
> >>> Otherwise, just do strtotime(endtime) - strtotime(starttime) / 60.
> >>> That's the difference in minutes.
> >>>
> >>> Regards
> >>> Peter
> >>>
> >>>
> >>> --
> >>> 
> >>> WWW: http://plphp.dk / http://plind.dk
> >>> LinkedIn: http://www.linkedin.com/in/plind
> >>> BeWelcome/Couchsurfing: Fake51
> >>> Twitter: http://twitter.com/kafe15
> >>> 
> >>>
> >>
> >>
> >>
> >> --
> >> ::Bruce::
> >>
> >
> >
> >
> > --
> > 
> > WWW: http://plphp.dk / http://plind.dk
> > LinkedIn: http://www.linkedin.com/in/plind
> > BeWelcome/Couchsurfing: Fake51
> > Twitter: http://twitter.com/kafe15
> > 
> >
>
>
>
> --
> ::Bruce::
>
>
>
> The value returned from strtotime() is a timestamp, the value you output
> from MySQL isn't a timestamp, it's a string-formatted timestamp. If you need
> to format a timestamp use the date() function.
>
>   Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>


-- 
::Bruce::


Re: [PHP] determining time difference between two timestamp fields.

2010-05-25 Thread Bruce Gilbert
the resulting output with that code is a little weird. I get September
3, 1970 2:39:32pm

I think part of the problem is my Query. When I run it in PHP MyAdmin
I get a null value for login_timestamp even though there is indeed a
timestamp there. The Query again is:

SELECT 
Responses.editor_name,Answer1,Answer2,Answer3,Answer4,Answer5,Answer6,Answer7,Answer8,Answer9,Answer10,Answer11,Answer12,submit_timestamp,login_timestamp
FROM Responses LEFT JOIN Candidates USING (user_id)

login_timestamp is in a table called 'Candidates' and submit_timestamp
is in a tables called 'Responses'.

thanks for all the help to this point.

On Tue, May 25, 2010 at 2:28 PM, Ashley Sheridan
 wrote:
> On Tue, 2010-05-25 at 14:22 -0400, Bruce Gilbert wrote:
>> echo "Completion Time:". date('F j, Y
>> g:i:sa',strtotime($row['submit_timestamp']) -
>> strtotime($row['login_timestamp']))/60 , "";
>
> There's a good reason for that! What you're actually doing is this:
>
> echo "Completion Time:" .
>  date('F j, Y g:i:sa',
>    strtotime($row['submit_timestamp']) -
>    strtotime($row['login_timestamp'])
>  )
>  / 60
>  , "";
>
> You're trying to divide a string by 60, because date() returns a string.
> Put that division inside the brackets for date() rather than outside.
>
> It might help to break up that whole line of output into several parts.
> Put the date into a variable and then just output the HTML line:
>
> $date = date('F j, Y g:i:sa', (strtotime($row['submit_timestamp']) -
> strtotime($row['login_timestamp']))/60);
> echo "Completion Time:$date";
>
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
>



-- 
::Bruce::

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



Re: [PHP] determining time difference between two timestamp fields.

2010-05-25 Thread Bruce Gilbert
yea, not sure why my Query isn't returning a value though? If I don't
use date(), what should I use?

the SQL for the timestamps looks like this.
`login_timestamp` datetime NOT NULL default '-00-00 00:00:00',
`submit_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,

sorry for the top-posting, but I think you have to in gmail.


On Tue, May 25, 2010 at 3:14 PM, Peter Lind  wrote:
> On 25 May 2010 21:09, Bruce Gilbert  wrote:
>> the resulting output with that code is a little weird. I get September
>> 3, 1970 2:39:32pm
>>
>> I think part of the problem is my Query. When I run it in PHP MyAdmin
>> I get a null value for login_timestamp even though there is indeed a
>> timestamp there. The Query again is:
>>
>> SELECT 
>> Responses.editor_name,Answer1,Answer2,Answer3,Answer4,Answer5,Answer6,Answer7,Answer8,Answer9,Answer10,Answer11,Answer12,submit_timestamp,login_timestamp
>>        FROM Responses LEFT JOIN Candidates USING (user_id)
>>
>> login_timestamp is in a table called 'Candidates' and submit_timestamp
>> is in a tables called 'Responses'.
>>
>> thanks for all the help to this point.
>>
>> On Tue, May 25, 2010 at 2:28 PM, Ashley Sheridan
>>  wrote:
>>> On Tue, 2010-05-25 at 14:22 -0400, Bruce Gilbert wrote:
>>>> echo "Completion Time:". date('F j, Y
>>>> g:i:sa',strtotime($row['submit_timestamp']) -
>>>> strtotime($row['login_timestamp']))/60 , "";
>>>
>>> There's a good reason for that! What you're actually doing is this:
>>>
>>> echo "Completion Time:" .
>>>  date('F j, Y g:i:sa',
>>>    strtotime($row['submit_timestamp']) -
>>>    strtotime($row['login_timestamp'])
>>>  )
>>>  / 60
>>>  , "";
>>>
>>> You're trying to divide a string by 60, because date() returns a string.
>>> Put that division inside the brackets for date() rather than outside.
>>>
>>> It might help to break up that whole line of output into several parts.
>>> Put the date into a variable and then just output the HTML line:
>>>
>>> $date = date('F j, Y g:i:sa', (strtotime($row['submit_timestamp']) -
>>> strtotime($row['login_timestamp']))/60);
>>> echo "Completion Time:$date";
>>>
>
> There are two problems you're looking at. The first is the null value
> you're getting, which will invalidate the whole thing. The second
> problem is that you were looking for output along the lines of "60
> minutes" but you're using date() which as the second parameter expects
> a unix timestamp - not two timestamps subtracted from each other.
>  On another note, subtracting the output of two strtotime() calls
> inside the date() call doesn't amount to subtracting anything from a
> string.
>
> Regards
> Peter
>
> --
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> BeWelcome/Couchsurfing: Fake51
> Twitter: http://twitter.com/kafe15
> 
>



-- 
::Bruce::

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



Re: [PHP] determining time difference between two timestamp fields.

2010-05-25 Thread Bruce Gilbert
thanks again for all the help.

>The output of strtotime() is an int - specifically a number of
>seconds. Subtract two number of seconds from each other and what do
>you get? Furthermore, divide by 60 and what do you get?
> Should you want to format this, you can consider sprintf(), though,
>if you just want a whole number of minutes, just use floor().

I am using floor() now instead of date()

> Try just selecting all values from your database, to see what's
> actually in there.

I found out the problem.the value in (user_id) in the two tables has
to be the same. That is why the Query wasn't working.

I still am not getting the desired result though. Something that
should be displaying as five minutes displays as -117 minutes

My current code.
$submit_time = strtotime($row['submit_timestamp']);
$login_time = strtotime($row['login_timestamp']);

$completion_time = $submit_time - $login_time;
$completion_time /= 60;

$formatted_completion_time = floor($completion_time );

echo "Completion Time:";
echo $formatted_completion_time;
echo " minutes";
echo "";


On Tue, May 25, 2010 at 3:54 PM, Peter Lind  wrote:
> On 25 May 2010 21:50, Bruce Gilbert  wrote:
>> yea, not sure why my Query isn't returning a value though? If I don't
>> use date(), what should I use?
>
> The output of strtotime() is an int - specifically a number of
> seconds. Subtract two number of seconds from each other and what do
> you get? Furthermore, divide by 60 and what do you get?
>  Should you want to format this, you can consider sprintf(), though,
> if you just want a whole number of minutes, just use floor().
>
>> the SQL for the timestamps looks like this.
>> `login_timestamp` datetime NOT NULL default '-00-00 00:00:00',
>> `submit_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
>
> Try just selecting all values from your database, to see what's
> actually in there.
>
>> sorry for the top-posting, but I think you have to in gmail.
>
> No you don't, that's ridiculous.
>
> --
> 
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> BeWelcome/Couchsurfing: Fake51
> Twitter: http://twitter.com/kafe15
> 
>



-- 
::Bruce::

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



[PHP] still having trouble with time-stamp subtraction two mysql fields

2010-05-27 Thread Bruce Gilbert
Hi there,

I am still attempting to get a display of the result of my two
timestamp fields subtracted from one another in minutes and hours if
needed. This is for a form and the timestamps are recorded when a user
logs in [login_timestamp] and when the form is
submitted[submit_timestamp]. The display still doesn't appear to be
accurate and for some reason the results are displayed three times for
each record underneath the results for one person. So it looks
something like.

Tom Thumb
Answer 1
Answer 2
Answer 3 etc.
[time 1]
[time 2]
[time 3]

Sally Smith
Answer 1
Answer 2
Answer 3 etc.
[time 1]
[time 2]
[time 3]

Bob Jones
Answer 1
Answer 2
Answer 3
[time 1]
[time 2]
[time 3]

time1,2,3 being for Tom Thumb, Sally Smith and Bob Jones respectively.

My entire code for the form looks like this.



Exam Results



exam results

Candidate Name

{$row['name']}";
echo "Section 1";

   for ($i =1;$i<9;++$i) {
echo "{$row['Answer'.$i]}";
  }
echo "Section 2";

echo "{$row['Answer10']}";
echo "Section 3";

echo "{$row['Answer11']}";
echo "Section 4";

echo "{$row['Answer12']}";



$sql_timestamp = "SELECT
TIMESTAMPDIFF(SECOND,submit_timestamp,login_timestamp) as cTime FROM
Responses LEFT JOIN Candidates USING (user_id)";

$result_timestamp = mysql_query($sql_timestamp);
if (!$result_timestamp) {
echo "Could not successfully run query ($sql_timestamp) from DB: "
. mysql_error();
exit;
}
while($row = mysql_fetch_assoc($result_timestamp)){
  $formatted_completion_time = formatTime($row['cTime']);
  echo "Completion Time:\n";
  echo $formatted_completion_time;
  echo "";
}

}
mysql_free_result($result);



?>





and my function code for the subtracting of the two fields is here:



any assistance that can be provided is greatly appreciated.

-- 
::Bruce::

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



[PHP] open source PHP/MySQL image viewing application

2008-02-14 Thread Bruce Gilbert
can anyone reccomend an open source PHP/MySQL based image viewing
application. I am looking to store the images in MySQL and have a
viewer on the page with the option to click to the next image and
back, possibly with the display of an enlarged image as well as the
option to click on thumbnails below.

this may also be somehting I could look into creating from scratch,
but I dodn't want to re-invent the wheel if I don't have to...

-- 
::Bruce::

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



[PHP] recommendations for good breacrumbs script

2006-03-11 Thread Bruce Gilbert
Hello,

I am looking around for a good PHP breadcrumbs navigation script that
would out put a path based on file structure.  For instance if I had a
folder called Portfolio and within that folder I had a index.php file
and another file called Websites.php. When I was on the websites.php
page, the breadcrumbs path would display Home >> Portfolio >> Websites
and Home and Portfolio would be hyperlinks. I don't want the
breadcrumbs to display a .php extension. I could of course hard code
this, but would rather find an automated solution.

Thanks in advance for any assistance!

--
::Bruce::

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



[PHP] PHP code not functioning on search page

2006-03-13 Thread Bruce Gilbert
I have a bit of PHP rotating image code and time stamp that work fine
on every page except my search page
http://inspired-evolution.com/search.php. I installed a PHP based
search engine called Zoom Search as a plug-in in Dreamweaver. Since
the code works on every other page, I am not sure why it wouldn't on
this page. An example of a page where the code works fine is
http://inspired-evolution.com/search_template.php

Any assistance?

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



[PHP] help with setting menu styles with PHP

2006-03-16 Thread Bruce Gilbert
 am trying to accomplish something utlizing PHP. What I have is a menu
marked up as such:



About Me
Skill set
Hire
Me
Portfolio
Contact
Résumé
http://inspiredevolution.blogs.com/inspiredevolutioncom/";
title="the blog for Inspired-Evolution.com" >Blog
RSS




and then I have everything styled nicely with CSS to give you the menu you
see here:

http://www.inspired-evolution.com/About_Me.php

What I want to do next is to change the menu from being hard coded on all of
my pages to being an include making the menu more manageable. The stumbling
block is I want to be able to keep the CSS functionality where you have the
active indicator which has different CSS for the link of the page you are
on. I have seen this done with PHP before with something like IF on active
page use this style  ELSE use this style. Can any PHP gurus assist me in
coding something like this?

I don't believe it is too difficult, but beyond by scope right at the
moment.


[PHP] PHP search

2005-06-26 Thread Bruce Gilbert
Hello,

I am fairly new to PHP, and I am looking to create a search
functionality on a website using php. Can anyone point me to a good
tutorial that can walk me through this?

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



[PHP] trouble with file upload page using PHP

2005-07-06 Thread Bruce Gilbert
I am testing a page that uploads a file to my server using PHP.

I get an error stating:

"Warning: copy(/hsphere/local/home/bruceg/inspired-evolution.com/LOR-BRUCE.pdf):
failed to open stream: Permission denied in
/hsphere/local/home/bruceg/inspired-evolution.com/Uploader.php on line
4
Could not copy file"

the page is at http://inspired-evolution.com/Uploader.php

and the PHP code is:




 Sent: 
Size:  bytes 
Type: 



is there a way to accomplish this by adding something to the script above?

thanks,

Bruce

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



[PHP] connecting to MySQL from a Mac

2005-07-12 Thread Bruce Gilbert
Hello,

I am trying to add a PHP search to my site and the read me file says to:

2. In the server, create a database in MySQL to hold Sphider data.

a) at command prompt type (to log into MySQL):
mysql -u  -p
Enter your password when prompted.

b) in MySQL, type:
CREATE DATABASE sphider_db;

trouble is I am on a mac, so there is no command prompt. What are mac
users supposed to do???

Of course you can use some other name for database instead of sphider_db.

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



[PHP] cannot connect to MySQL server and not sure why

2005-07-14 Thread Bruce Gilbert
I am having trouble connecting to MySQL server through a PHP script
and I am not sure why.

the error I receive is:

Warning: mysql_pconnect(): Access denied for user:
'[EMAIL PROTECTED]' (Using password: YES) in
/hsphere/local/home/bruceg/inspired-evolution.com/search/include/connect.php
on line 6
Cannot connect to database, check if username, password and host are correct.

trying to connect with the following script:

?php
$database="bruceg_search";
$mysql_user = "bruceg_webmaster";
$mysql_password = " password"; 
$mysql_host = "server-10.existhost.com";
mysql_pconnect ($mysql_host, $mysql_user, $mysql_password);  
if (!$success)
die ("Cannot connect to database, check if username, 
password and
host are correct.");
$success = mysql_select_db ($database);
if (!$success) {
print "Cannot choose database, check if database name is 
correct.";
die();
}
?>

I double checked the database and I have created a database called
bruceg_search and added a user called bruceg_webmaster with all of the
editing privileges. Of course 'password' is changes with the password
used to connect in the actual script. and I double checked that to be
correct as well. Any suggestions?

-- 
::Bruce::

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



[PHP] not sure why form submission gives me error

2005-07-15 Thread Bruce Gilbert
Hello,

I have a form on my site 

http://www.inspired-evolution.com/Contact.php

produces this error on submission

Parse error: parse error, unexpected T_STRING in
/hsphere/local/home/bruceg/inspired-evolution.com/Thankyou.php on line
35

here is the PHP code, please let me know if you see where the error is:

Also, if someone has a good editor, that may provide the clue. I don't
have a good PHP editor at my disposal yet :-(

Error! Fields marked * are required to
continue.';include 'include/contact.php'; return; }

if (!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*"
."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email)) {
echo 'Invalid email address entered'; include
'include/contact.php';  return; }

$formsent=mail("[EMAIL PROTECTED]",
"There has been a disturbance in the force",
"Request from:$firstname $lastname\r\n
Company name: $company\r\n
Phone Number:  $phone\r\n
Email Address: $email\r\n
Retyped Email Address: $email2\r\n
URL: $URL\r\n
Please Contact me via: $Contact_Preference\r\n
The best time to reach me is: $Contact_Time\r\n
I wish to request the following additional information: $Textarea");
if ($formsent) {
  echo " Hello, $firstname.
 We have received your request for additional information, and will
respond shortly.
 Thanks for visiting inspired-evolution.com and have a wonderful day!";

}
?>

-- 
::Bruce::

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



[PHP] Re: not sure why form submission gives me error

2005-07-16 Thread Bruce Gilbert
Thanks guys. I am on a Mac and have BBEdit light, which is not too
great for PHP editing, from m experience.

On 7/16/05, Burhan Khalid <[EMAIL PROTECTED]> wrote:
> Edward Vermillion wrote:
> > Bruce Gilbert wrote:
> > 
> >> Hello,
> >>
> >> I have a form on my site
> >> http://www.inspired-evolution.com/Contact.php
> >>
> >> produces this error on submission
> >>
> >> Parse error: parse error, unexpected T_STRING in
> >> /hsphere/local/home/bruceg/inspired-evolution.com/Thankyou.php on line
> >> 35
> > 
> > 
> > Well.. it says it's found a string it wasn't expecting on, or around, 
> > line 35 but I can't find it. Did you cut and past the code here or 
> > retype it when you posted?
> > 
> > BTW... A nice editor for windows is Crimson Editor, and for the mac 
> > TextWrangler works pretty good too. Both have built in FTP features that 
> > are easy to use and some decent syntax highlighting. And both are free. 
> > If your on *nix then I'm not gonna start that war... :P
> 
> A good website to go for that sort of information is php-editors.com
> 
> My personal recommendations:
> 
> Windows - EditPlus (syntax highlighting, edit-over-ftp, etc.)
>  - SciTE (syntax highlighting, code-complete (ie, IntelliSense))
>  - UltraEdit
> 
> Linux   - pick your favorite, I prefer vim for console editing
>  - for X11 editors, Kate, SciTE, etc. all work great
> 
> Mac - BBEdit (one of -- if not THE -- best text editor for Mac)
>  - SubethaEdit (great editor with unique features)
> 
> As for your PHP issue, check for im-properly nested " " marks.  Would be 
> good if you highlighted what lines 33-37 were.
> 
> -- Burhan
> 
> 
> 


-- 
::Bruce::

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



[PHP] still some problems with contact form

2005-07-19 Thread Bruce Gilbert
Hello,

on my web site contact form:

http://www.inspired-evolution.com/Contact.php

I am still having a few problems with the return results after filling
out the form. Basically I am wanted to return an error msg. when all
of the required fields are not filled out (those with a red *), and an
invalid email address will also return an error.

filling out all of the information correctly will result in a
thank-you paragraph, we have received your submission etc.

Right now even if you don't fill out the required fields, you still
get my thank-you message for filling out the form correctly (as well
as getting the error msg.). If someone has a chance try out the form
yourself and you will see what I mean.

What I would really like to have is a thank-you page when the form is
completed sucussfully and an oops! page when there is an error. SO we
are talking two different pages, based upon the results of the form
information...

The PHP code I have for the return info. currenty is:

Error! Fields marked 
* are required to continue.';
echo'Please go back to the Contact Me page and try it again!';
} 

if 
(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*"."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email))
{
 
echo 'Invalid email address entered.';
echo 'Please go back to the Contact Me page and try it again!';
}
if (($email) != ($email2)) {
 
echo 'Error! e-mail addresses dont match.';

 
}
 
$email_address = "[EMAIL PROTECTED]";
$subject = "There has been a disturbance in the force";
 
$message = "Request from: $firstname $lastname\n\n
Company name: $company\n
Phone Number:  $phone\n
Email Address: $email\n
URL: $URL\n
Please Contact me via: $Contact_Preference\n
The best time to reach me is: $Contact_Time\n
I wish to request the following additional information: $Textarea";
 
mail($email_address, $subject, $message, "From: $email \nX-Mailer:
PHP/" . phpversion());
 
echo "Hello, $firstname.
We have received your request for additional information, and will
respond shortly.
Thanks for visiting inspired-evolution.com and have a wonderful day!
Regards,
Inspired Evolution";

?>

any assistance/guidance is greatly appreciated. Thanks list!

Bruce G.
http://www.inspired-evolution.com

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



[PHP] Re: still some problems with contact form

2005-07-19 Thread Bruce Gilbert
thanks, makes some sense.

so now where I have echo, I should have print? or just leave as echo
and add the else and ||?

Could you provide some sample code based on the code I posted
previously by chance??

being new to PHP I am sure I will run into errors for a few days, as is...

that would help me out greatly.



thx,

On 7/19/05, James <[EMAIL PROTECTED]> wrote:
> This is what you have done
> 
> if(something happens) {
> print error;
> }
> 
> print thanks for sending the form!
> 
> So basically you are printing the error and then thanking them. You need to
> 
> include an ELSE bracket. Like so..
> 
> if(this error || that error || some other error) {
> print error;
> } else {
> //no errors, thank them!
>print THANKS!
> }
> 
> - Original Message - 
> From: "Bruce Gilbert" <[EMAIL PROTECTED]>
> To: 
> Sent: Tuesday, July 19, 2005 5:52 PM
> Subject: [PHP] still some problems with contact form
> 
> 
> Hello,
> 
> on my web site contact form:
> 
> http://www.inspired-evolution.com/Contact.php
> 
> I am still having a few problems with the return results after filling
> out the form. Basically I am wanted to return an error msg. when all
> of the required fields are not filled out (those with a red *), and an
> invalid email address will also return an error.
> 
> filling out all of the information correctly will result in a
> thank-you paragraph, we have received your submission etc.
> 
> Right now even if you don't fill out the required fields, you still
> get my thank-you message for filling out the form correctly (as well
> as getting the error msg.). If someone has a chance try out the form
> yourself and you will see what I mean.
> 
> What I would really like to have is a thank-you page when the form is
> completed sucussfully and an oops! page when there is an error. SO we
> are talking two different pages, based upon the results of the form
> information...
> 
> The PHP code I have for the return info. currenty is:
> 
>  
> $firstname = $_POST['firstname'];
> $lastname = $_POST['lastname'];
> $company = $_POST['company'];
> $phone = $_POST['phone'];
> $email = $_POST['email'];
> $email2 = $_POST['email2'];
> $URL = $_POST['URL'];
> $Contact_Preference = $_POST['Contact_Preference'];
> $Contact_Time = $_POST['Contact_Time'];
> $message = $_POST['Message'];
> 
> if ((!$firstname) || (!$Contact_Preference)) {
> 
> echo'Error! Fields marked 
> * are required to continue.';
> echo'Please go back to the Contact Me page and try it again!';
> }
> 
> if 
> (!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*"."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email))
> {
> 
> echo 'Invalid email address entered.';
> echo 'Please go back to the Contact Me page and try it again!';
> }
> if (($email) != ($email2)) {
> 
> echo 'Error! e-mail addresses dont match.';
> 
> 
> }
> 
> $email_address = "[EMAIL PROTECTED]";
> $subject = "There has been a disturbance in the force";
> 
> $message = "Request from: $firstname $lastname\n\n
> Company name: $company\n
> Phone Number:  $phone\n
> Email Address: $email\n
> URL: $URL\n
> Please Contact me via: $Contact_Preference\n
> The best time to reach me is: $Contact_Time\n
> I wish to request the following additional information: $Textarea";
> 
> mail($email_address, $subject, $message, "From: $email \nX-Mailer:
> PHP/" . phpversion());
> 
> echo "Hello, $firstname.
> We have received your request for additional information, and will
> respond shortly.
> Thanks for visiting inspired-evolution.com and have a wonderful day! />
> Regards,
> Inspired Evolution";
> 
> ?>
> 
> any assistance/guidance is greatly appreciated. Thanks list!
> 
> Bruce G.
> http://www.inspired-evolution.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php 
> 
> 


-- 
::Bruce::

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



[PHP] quick question about using capital letters coding w/ PHP

2005-07-24 Thread Bruce Gilbert
Hello,

I am well versed in coding with xhtml which requires all lower case
and am pretty much a newbie at PHP so that is why I am asking this
question.

is this acceptible 

if ($_post [sender_email] == "") or does at have to be if ($_POST
[sender_email] == "")

in short, do uppercase and lowercase always have the same meaning.

thx,

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



[PHP] PHP error on form

2005-07-28 Thread Bruce Gilbert
Hello,

I am trying to get a form to work integrating html with PHP.

the code I have is:


Your Name:< /br>

< /br>

Message:< /br>



";

if ($_POST['op'] !="ds") {
// they need to see the form
echo "$form_block";
} else if ($_POST['op'] =="ds") {
//check value of $_POST['sender name']
if ($_POST['sender_name'] =="") {
$name_err = "Please enter your 
name!< /br>";
$send ="no";
}
//check value of $_POST['sender_email']
if ($POST['sender_email'] =="") {
$email_err ="Please enter your email 
address!< /br>";
$send= "no";
}
//check value of $_POST['message']
if ($POST['message'] =="") {
$message_err = "Please enter a message!< 
/br>";
$send ="no";
}
if ($send !="no") {
//it's o.k to send, so build the mail
$msg ="E-MAIL SENT FROM WWW SITE\n";
$msg .="Senders Name:   $POST['senders_name']\n";
$msg .="Senders E-MAIL: 
$POST['senders_email']\n";
$msg .="Senders Name:   $POST['message']\n\n";
$to ="[EMAIL PROTECTED]";
$subject = "There has been a disturbance in the Force";
$mailheaders .="Reply-To: $_POST['sender_email']\n";
//send the mail
mail ($to, $subject, $msg, $mailheaders);
//display confirmation to user
echo "mail has been sent!";
} else if ($send =="no") {
//print error messages
echo "$name_err";
echo "$email_err";
echo "$message_err";
echo "$form_block";
}
}
?>

and the error I get is:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting T_STRING or T_VARIABLE or T_NUM_STRING in
/hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form_test.php
on line 58

the above code is just the php form part of the page not the entire
code, so it would be impossible to determine line 58, but I was hoping
someone would be able to spot the problem or at least explain the
error to a relative newbie.

thanks

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



[PHP] Re: PHP error on form

2005-07-28 Thread Bruce Gilbert
I made the suggestions mentioned by Mike and don't get any error, but
the form doesn't work properly. Check it out at
http://www.inspired-evolution.com/Contact_Form_test.php

the PHP form CODE I now have is:

Your Name:

Your E-mail Address:

Message:



";

if ($_POST['op'] !="ds") {
// they need to see the form
echo "$form_block";
} else if ($_POST['op'] =="ds") {
//check value of $_POST['sender name']
if ($_POST['sender_name'] =="") {
$name_err = "Please enter your 
name!";
$send = "no";
}
//check value of $_POST['sender_email']
if ($POST['sender_email'] =="") {
$email_err ="Please enter your email 
address!";
$send= "no";
}
//check value of $_POST['message']
if ($POST['message'] =="") {
$message_err = "Please enter a 
message!";
$send ="no";
}
if ($send !="no") {
//it's o.k to send, so build the mail
$msg ="E-MAIL SENT FROM WWW SITE\n";
$msg .="Senders Name:   $POST{['senders_name']}\n";
$msg .="Senders E-MAIL: 
$POST{['senders_email']}\n";
$msg .="Senders Name:   {$POST['message']}\n\n";
$to ="[EMAIL PROTECTED]";
$subject = "There has been a disturbance in the Force";
$mailheaders .="Reply-To: {$_POST['sender_email']}\n";
//send the mail
mail ($to, $subject, $msg, $mailheaders);
//display confirmation to user
echo "mail has been sent!";
} else if ($send =="no") {
//print error messages
echo "$name_err";
echo "$email_err";
echo "$message_err";
echo "$form_block";
}
}
?>




On 7/28/05, Mike Johnson <[EMAIL PROTECTED]> wrote:
> From: Bruce Gilbert [mailto:[EMAIL PROTECTED] 
> 
> > Hello,
> > 
> > I am trying to get a form to work integrating html with PHP.
> > 
> > the code I have is:
> > 
> >  > $form_block = "
> > 
> > Your Name:< /br>
> > 
> > < /br>
> > 
> > Message:< /br>
> > 
> > 
> >  > Form\">
> > ";
> > 
> > if ($_POST['op'] !="ds") {
> > // they need to see the form
> > echo "$form_block";
> > } else if ($_POST['op'] =="ds") {
> > //check value of $_POST['sender name']
> > if ($_POST['sender_name'] =="") {
> > $name_err = "Please 
> > enter your name!< /br>";
> > $send ="no";
> > }
> > //check value of $_POST['sender_email']
> > if ($POST['sender_email'] =="") {
> > $email_err ="Please enter your 
> > email address!< /br>";
> > $send= "no";
> > }
> > //check value of $_POST['message']
> > if ($POST['message'] =="") {
> > $message_err = "Please enter a 
> > message!< /br>";
> > $send ="no";
> > }
> > if ($send !="no") {
> > //it's o.k to send, so build the mail
> > $msg ="E-MAIL SENT FROM WWW SITE\n";
> > $msg .="Senders Name:   
> > $POST['senders_name']\n";
> > $msg .="Senders E-MAIL: 
> > $POST['senders_email']\n";
> > $msg .="Senders Name:   $POST['message']\n\n";
> > $to ="[EMAIL PROTECTED]";
> > $subject = "There has been a disturbance in the Force";
> > $mailheaders .="Reply-To: $_POST['sender_email']\n";
> > //send the mail
> > mail ($to, $subject, $msg, $mailheaders);
> > //display confirmation to user
> > echo "mail has been sent!";
> > } else if ($send =="no") {
> > //print error messages
> > echo "$name_err";
> > echo "$email_err";
> > echo "$message_err";
> > echo "$form_block";
> > }
>

[PHP] PHP form not working

2005-07-28 Thread Bruce Gilbert
Here is the entire code on the page. Now I am getting an error again...

http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
http://www.w3.org/1999/xhtml"; xml:lang="en-US"
lang="en-US" dir="ltr">


Form Test>




 


Skip over navigation
 

 


About Me
Skill set
Hire Me
Portfolio
Contact
Résumé
Blog
RSS



 

 
Home  > >  Contact
 


Contact

Your Name:

Your E-mail Address:

Message:



";

if ($_POST['op'] !="ds") {
// they need to see the form
echo "$form_block";
} else if ($_POST['op'] =="ds") {
//check value of $_POST['sender name']
if ($_POST['sender_name'] =="") {
$name_err = "Please enter your 
name!";
$send = "no";
}
//check value of $_POST['sender_email']
if ($POST['sender_email'] =="") {
$email_err ="Please enter your email 
address!";
$send= "no";
}
//check value of $_POST['message']
if ($POST['message'] =="") {
$message_err = "Please enter a 
message!";
$send ="no";
}
if ($send !="no") {
//it's o.k to send, so build the mail
$msg ="E-MAIL SENT FROM WWW SITE\n";
$msg .="Senders Name:   $POST{['senders_name']}\n";
$msg .="Senders E-MAIL: 
$POST{['senders_email']}\n";
$msg .="Senders Name:   {$POST['message']}\n\n";
$to ="[EMAIL PROTECTED]";
$subject = "There has been a disturbance in the Force";
$mailheaders .="Reply-To: {$_POST['sender_email']}\n";
//send the mail
mail ($to, $subject, $msg, $mailheaders);
//display confirmation to user
echo "mail has been sent!";
} else if ($send =="no") {
//print error messages
echo "$name_err";
echo "$email_err";
echo "$message_err";
echo "$form_block";
}
}
?>

* indicates a required field.




 




Inspired-Evolution - Web Site: Design,
Development, Marketing for Raleigh/Durham, Chapel Hill, Cary North
Carolina.








http://inspired-evolution.com/Contact_Form_test.php

error is on line 52

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



[PHP] returning info. from a form selection

2005-08-01 Thread Bruce Gilbert
can anyone give me an idea on how to return info. from a forl pulldown menu

eg:


  Purchase
  Construct Home
  


and return that to an email address.


thanks



-- 
::Bruce::

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



[PHP] cannot find the parse error

2005-08-02 Thread Bruce Gilbert
I am getting the following parsing error and don't see it off hand.

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting T_STRING or T_VARIABLE or T_NUM_STRING in
/hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form.php on
line 44

here is all of the code:

if anyone has any clues please let me know!

the URL is:http://www.inspired-evolution.com/Contact_Form.php
PHP info is at http://www.inspired-evolution.com/info.php

http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
http://www.w3.org/1999/xhtml"; xml:lang="en-US"
lang="en-US" dir="ltr">


Inspired Evolution :: Contact












 Skip
over navigation
  
  

  
  
   

  About
Me
  Skill set
  Hire
Me
  Portfolio
  Contact
  Résumé
  Blog
  RSS

  
  
   

Home
  > > Contact

  
  Contact
  

Additional Information
Request



* First Name: 






* Last Name:






* Company: 





* Phone: 





* e-mail: 





* re-enter e-mail: 






 URL:

 



 Best way to reach:





 Best time to contact:









Send me a detailed
message specifying what you wish to accomplish with your web
site.






END_FORM;
if ($_POST['op']!='ds') { 
// they need to see the form
echo "$form_block";
} else if ($_POST["op"]  == "ds")  {
// check value of $_POST['firstname']
if ($_POST['firstname'] == " ")  {
$name_err = 'Please enter your first
name!< /br>';
$send = "no" ;
}
// check value of $POST['email']
if ($_POST ['email'] == " ")  {
$email_err ='Please enter your email
address!';
$send="no";
}
if ($send != "no") {
//it's ok to send, so build the mail
$msg = "E-mail sent from www site\n";
$msg .="Sender's first name:{$_POST['firstname']}\n";
$msg .="Sender's last name:{$_POST['lastname']}\n";
$msg .="Company name:{$_POST['company']}\n";
$msg .="Senders Phone number:{$_POST['phone']}\n";
$msg .="Senders email address:{$_POST['email']}\n";
$msg .="Senders email address (re-typed):{$_POST['email2']}\n";
$msg .="URL :{$_POST['URL']}\n";
$msg .="Contact_Preference: {$_POST['Contact_Preference']}\n";
$msg .="Contact_Time {$_POST['Contact_Time']}\n";
$msg .="Message:{$_POST['message']}\n\n";
$to ="[EMAIL PROTECTED]";
$subject ="There has been a disturbance in the force";
$mailheaders .="From: My Web Site
\n";
$mailheaders .="Reply-To: {$_POST['email']}\n";
//send the mail
mail ($to, $subject, $msg, $mailheaders);
//display information to user
  echo "Hola, $firstname!.
We have received your request for additional information, and will
respond shortly.
Thanks for visiting inspired-evolution.com and have a wonderful day!
Regards,
Inspired Evolution";
 
} else if ($send =="no") {
//print error messages
echo "$name_err";
echo "$email_err";
echo "$message_err";
echo "$form_block";
}
}
?>
  * indicates a required field.
  
  
  


 
  Inspired-Evolution - Web Site: Design, Development, 
Marketing for Raleigh/Durham, Chapel Hill, Cary North Carolina.
  
  
  
   
  




-- 
::Bruce::

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



[PHP] regarding form submission and option pull down menu

2005-08-02 Thread Bruce Gilbert
a few more questions about the submission process for a form with
option choices.

say I am using :



Purchase
  Construct Home
  Refinance - No Cash
  Refinance - Cash
Out



is it better to use a name for value (the same as the selection
choice) or a number 1,2,3 etc? (or does it matter).

and for the return info what's the difference between:



and without the isset?

thanks!






-- 
::Bruce::

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



[PHP] need help finding parsing error please

2005-08-05 Thread Bruce Gilbert
Hello,

I am getting this on the following code, and I am not sure what is
causing the error and need some pros to take a look at it for me.

the error is:

Parse error: parse error, unexpected '{' in
/hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form2.php on
line 161

here is the ENTIRE page code:

http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
http://www.w3.org/1999/xhtml"; xml:lang="en-US"
lang="en-US" dir="ltr">


Inspired Evolution :: Contact












 Skip
over navigation
  
  

  
  
   

  About
Me
  Skill set
  Hire
Me
  Portfolio
  Contact
  Résumé
  Blog
  RSS

  
  
   

Home
  > > Contact

  
  Contact
  

Additional Information
Request



* First Name: 






* Last Name:






* Company: 





* Phone: 





* e-mail: 





* re-enter e-mail: 






 URL:

 



 Best way to reach:





 Best time to contact:











Send me a detailed
message specifying what you wish to accomplish with your web
site.






* indicates a required field.
END_FORM;
if ($_POST['op']!='ds') { 
// they need to see the form
echo "$form_block";
} else if ($_POST["op"]  == "ds")  {

//Function saves time and space by eliminating unneccesary code
function check($fieldname)
{
global $err_msg;
if($_POST[$fieldname] == "")
{ 
if ( !isset($err_msg)) { $err_msg = "Please
re-enter your ".$fieldname.""; }
elseif ( isset($err_msg)) { $err_msg .="\nPlease
re-enter your ".$fieldname.""; }
}
return $err_msg;
}

//
///Function execution/
//

check('firstname');
check('lastname');
check('company');
check('phone');
check('email');
check('email2');
check('URL');
check('Contact_Preference');
check('Contact_Time');
check('message');  

//Validating Email Address
if ($_POST['email'] != $_POST['email2']) { $email_err = "\nEmail address fields do not match"; }

if (isset($err_msg) || isset($email_err) { echo
$err_msg.$email_err."\n\n".$form_block; }
else {
  //it's ok to send, so build the mail
$msg = "E-mail sent from www site\n";
$msg .="Sender's first name:{$_POST['firstname']}\n";
$msg .="Sender's last name:{$_POST['lastname']}\n";
$msg .="Company name:{$_POST['company']}\n";
$msg .="Senders Phone number:{$_POST['phone']}\n";
$msg .="Senders email address:{$_POST['email']}\n";
$msg .="Senders email address (re-typed):{$_POST['email2']}\n";
$msg .="URL :{$_POST['URL']}\n";
$msg .="Contact_Preference: {$_POST['Contact_Preference']}\n";
$msg .="Contact_Time {$_POST['Contact_Time']}\n";
$msg .="Message:{$_POST['message']}\n\n";
$to ="[EMAIL PROTECTED]";
$subject ="There has been a disturbance in the force";
$mailheaders ="From: Inspired-Evolution.com
\n";
$mailheaders .="Reply-To: {$_POST['email']}\n";
//send the mail
mail ($to, $subject, $msg, $mailheaders);
//display information to user
  echo "Hola, $firstname!.
We have received your request for additional information, and will
respond shortly.
Thanks for visiting inspired-evolution.com and have a wonderful day!
Regards,
Inspired Evolution";
}
?>


  
  
  
  


 
  Inspired-Evolution - Web Site: Design, Development, 
Marketing for Raleigh/Durham, Chapel Hill, Cary North Carolina.
  
  
  

   
  





and if this helps, here is the PHP info.
:
http://www.inspired-evolution.com/info.php

TIA!


-- 
::Bruce::

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



[PHP] re: blank page with PHP

2005-08-09 Thread Bruce Gilbert
I guess this would help. The URL to my PHP config is
http://www.wealthdevelopmentmortgage.com/test/form_test/info.php


-- 
::Bruce::

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



[PHP] blank page with PHP

2005-08-09 Thread Bruce Gilbert
I have a form which displays fine with html, but when I add the php
thew page is blank. I am re-using code which I have on another form so
I know it works. I was wondering if there might be something in the
PHP confuration which may be preventing the page from displaying. IE
error reporting .

Can someone take a look at my configuration settings and see if there
may be something to cause this? Of course there may be something I
missed in the code as weel, but it the past I always got some sort of
error, not just a blank page.

thanks, 

-- 
::Bruce::

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



[PHP] what should I look for with this error

2005-08-10 Thread Bruce Gilbert
I get this error a lot, and think it may be an easy fix, but don't
really know what to look for.

'Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting T_STRING or T_VARIABLE or T_NUM_STRING in
/hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form_Test.php
on line 556'

what does this indicate?


-- 
::Bruce::

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



Re: [PHP] what should I look for with this error

2005-08-10 Thread Bruce Gilbert
I don't see any missing semi-colons off hand. The error is supposedly
on line 556 in the below code:




 
Wealth Development Mortgage :: TEAM
 

  



 
   
 

 
  
HOME
CONTACT US
PAYMENT CALCULATOR
  

  
   
  
  
   

  HOME
  COMPANY
  TEAM
  CONTACT
  APPLY
ONLINE

  
  
  
   

  
 
  
   

TEAM
  
  
  
  
  
  Secure Loan Application 
  
  
Wealth Development Mortgage Company provides
fast mortgage approvals online.
  Your Application will be placed in top priority and receive
immediate attention.
  
   



   
LOAN INFORMATION


   
 
 
  Loan
Purpose:
 
  Purchase
  
  Refinance - No Cash
  Refinance - Cash
Out
  
  Refinance - Debt
Consolidation
  Refinance
- Change Loan Type
  Construction
Loan
  Other Loan
Purpose

  Property Use:


Select One
--
Primary Residence
Secondary
Residence
Investment
Property
  
  

 
  Loan Type:
 
  30 Year
Fixed
  15 Year Fixed
  10/1 
ARM
  7/1 ARM
  5/1 ARM
   3/1 
ARM
1 year 
ARM
6 month 
ARM
0ption ARM
10 
year Interest Only
5 
year Interest Only
3 
year Interest Only
HELOC

Property 
Type:

Single Family Detached
Townhouse
Condo
Multi 
Unit


  Interest Rate:
 
  Select One
  --
  1.000
  1.125
  1.250
  1.375
  1.500
  1.625
  1.750
  1.875
  2.000
  2.125
  2.250
  2.375
  2.500
  2.625
  2.750
  2.875
  3.000
  3.125
  3.250
  3.375
  3.500
  3.625
  3.750
  3.875
  4.000
  4.125
  4.250
  4.375
  4.500
  4.625
  4.750
  4.875
  5.000
  5.125
  5.250
  5.375
  5.500
  5.625
  5.750
  5.875
  6.000
  6.125
  6.250
  6.375
  6.500
  6.625
  6.750
  6.875
  7.000
  7.125
  7.250
  7.375
  7.500
  7.625
  7.750
  7.875
  8.000
  8.125
  8.250
  8.375
  8.500
  8.625
  8.750
  8.875
  9.000
  9.125
  9.250
  9.375
  9.500
  9.625
  9.750
  9.875
  10.000
  10.125
  10.250
  10.375
  10.500
  10.625
  10.750
 

Re: [PHP] what should I look for with this error

2005-08-11 Thread Bruce Gilbert
yea, I was able to get the  form to display, thanks.

On 8/11/05, Jay Blanchard <[EMAIL PROTECTED]> wrote:
> [snip]
> Your HEREDOC appears to be messed up. On line 623 the closing identifier
> is not in first column of the line (when I cut n paste the code into an
> editor. That is a requirement for the heredoc.
> 
> You also didn't close the PHP block after END_FORM;
> Then you need to open a PHP block at about line 635 before the if
> statement.
> [/snip]
> 
> Were you able to resolve this?
> 


-- 
::Bruce::

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



[PHP] need to convert field names into array for form submission

2005-08-12 Thread Bruce Gilbert
How would I organize this block in order to convert it into an array
for my form field names.

For instance if my field has:

Home Phone Number:   
  
  

I would want something to return an error stating that the phone
number was not completed and not that the field last_4_digits was not
entered.

I believe this can be done with an array.

my error block code is:

function check($fieldname)
   {
   global $err_msg;
   if($_POST[$fieldname] == "") {
   if ( !isset($err_msg)) {
   $err_msg = "You haven't entered
your " . str_replace("_", " ", $fieldname) . "!";
   } elseif ( isset($err_msg)) {
   $err_msg .="You haven't entered
your " . str_replace("_", " ", $fieldname) . "!";
   }
   }
   return $err_msg;
}

any assistance is greatly  appreciated!
-- 
::Bruce::

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



[PHP] form not submitting when I change action from PHP_SELF to thanks page

2005-10-05 Thread Bruce Gilbert
I have a form that submits and returns on the same page and works fine.

I know want to change the submission action from   {$_SERVER['PHP_SELF']}

to an external thanks page so the form method would change to:



now I need to know what else I have to change in the form below to
change to get the thanks page to submit the info. other than the
obvius which is to get rid of the echo thank-you msg. at the end of
the form.

Here is the current code:



About You

* First Name: 



* Last Name:



* Company: 



* Phone: 



* e-mail: 



* re-enter e-mail:





More Info.
*  URL:

 

*  Best
way to reach:


email
phone
snail mail




*  Best time to
contact:



morning
evening
anytime





Send us a
detailed message specifying what you wish to accomplish with your web
site. 





* indicates a required field (all fields
are required).
END_FORM;
if ($_POST['op']!='ds') {
echo "$form_block";
} else if ($_POST["op"] == "ds")  {

//Function saves time and space by eliminating unneccesary code
function check($fieldname)
{
global $err_msg;
if($_POST[$fieldname] == "")
{
if ( !isset($err_msg)) { $err_msg = "You 
haven't
entered your ".$fieldname."!"; }
elseif ( isset($err_msg)) { $err_msg="You 
haven't
entered your ".$fieldname."!"; }
}
return $err_msg;
}

//
///Function execution/
//

check('firstname');
check('lastname');
check('company');
check('phone');
check('email');
check('email2');
check('URL');
check('Contact_Preference');
check('Contact_Time');
check('message');

//Validating Email Address
if ($_POST['email'] != $_POST['email2']) { $email_err = "\ne-mail address fields do not match!"; }

if (isset($err_msg) || isset($email_err)) { echo
$err_msg.$email_err."\n\n".$form_block; }
else {
  //it's ok to send, so build the mail
$msg = "E-mail sent from www.inspired-evolution.com\n";
$msg .="Sender's first name:{$_POST['firstname']}\n";
$msg .="Sender's last name:{$_POST['lastname']}\n";
$msg .="Company name:{$_POST['company']}\n";
$msg .="Senders Phone number:{$_POST['phone']}\n";
$msg .="Senders email address:{$_POST['email']}\n";
$msg .="Senders email address (re-typed):{$_POST['email2']}\n";
$msg .="The website is :{$_POST['URL']}\n";
$msg .="I prefer to be contacted via: {$_POST['Contact_Preference']}\n";
$msg .="The Best time to contact is: {$_POST['Contact_Time']}\n";
$msg .="Message:{$_POST['message']}\n\n";
$to ="[EMAIL PROTECTED]";
$subject ="There has been a disturbance in the force";
$mailheaders ="From: Inspired-Evolution.com
\n";
$mailheaders .="Reply-To: {$_POST['email']}\n";
//send the mail
mail ($to, $subject, $msg, $mailheaders);
//display information to user
  echo "Hola, $firstname!.
We have received your request for a web site review , and will respond
shortly.
Thanks for visiting inspired-evolution.com and have a wonderful day!
Regards,
Inspired Evolution";
}

}
?>

any assistance is greatly appreciated

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



[PHP] Re: form not submitting when I change action from PHP_SELF to thanks page

2005-10-05 Thread Bruce Gilbert
thanks for the reply.

 and where on the page would that need to go? Within the head tags?
and would it need to be within 

???

On 10/5/05, Robert Cummings <[EMAIL PROTECTED]> wrote:
> On Wed, 2005-10-05 at 20:44, Bruce Gilbert wrote:
> > I have a form that submits and returns on the same page and works fine.
> >
> > I know want to change the submission action from   {$_SERVER['PHP_SELF']}
> >
> > to an external thanks page so the form method would change to:
> > 
>
> Why not just redirect to the thanks.php page when the submission is
> complete? That will require the addition of one line to your form page:
>
> header( 'Location: thanks.php' );
>
> Cheers,
> Rob.
> --
> ..
> | InterJinn Application Framework - http://www.interjinn.com |
> ::
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for   |
> | creating re-usable components quickly and easily.  |
> `'
>
>


--
::Bruce::

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



Re: [PHP] Re: form not submitting when I change action from PHP_SELF to thanks page

2005-10-06 Thread Bruce Gilbert
when I add that code I can the following error msg when submitting the form.
 " *Warning*: Cannot modify header information - headers already sent by
(output started at /home/webadmin/dedicated75.virtual.vps-
host.net/html/fortuneInteractive/Consultation_test.php:6<http://host.net/html/fortuneInteractive/Consultation_test.php:6>)
in */home/webadmin/dedicated75.virtual.vps-
host.net/html/fortuneInteractive/Consultation_test.php<http://host.net/html/fortuneInteractive/Consultation_test.php>
* on line *168* "
 line 168 is the one with header( 'Location: thanks.php' );
on it.
 can anyone explain why this is happening and how to rectify?
 TIA

 On 10/5/05, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
> On Wed, 2005-10-05 at 21:15, Bruce Gilbert wrote:
> > thanks for the reply.
> >
> > and where on the page would that need to go? Within the head tags?
> > and would it need to be within 
>
> Right after this line:
>
> mail ($to, $subject, $msg, $mailheaders);
>
> And you will already be within PHP interpretation.
>
> Cheers,
> Rob.
> --
> ..
> | InterJinn Application Framework - http://www.interjinn.com |
> ::
> | An application and templating framework for PHP. Boasting |
> | a powerful, scalable system for accessing system services |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for |
> | creating re-usable components quickly and easily. |
> `'
>
>


--
::Bruce::


Re: [PHP] Re: form not submitting when I change action from PHP_SELF to thanks page

2005-10-06 Thread Bruce Gilbert
I checked and no white space involved. What would I need to put tin the
exit()/die() function?

On 10/6/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:
>
> Check to make sure absolutely nothing before the header() function is
> outputing anything. No echos, no prints, no var_dumps, no HTML or even blank
> lines.
>
> If it's something tangible like an echo or print or something, then
> putting an exit()/die() function right before the header() function then
> looking at the HTML source that you get should show you what the offending
> output is.
>
> But again, if I recall, it can be something as simple as an empty line.
>
> -
> 
> // This should work because there's no output or white space above
> header()
> header('Location: thanks.php');
>
> ?>
> -
>
> -
>
> 
> // This should fail (if I recall) because of the blank line that's sent
> // before the PHP code block. This is considered output, and can't come
> before
> // any header statements
>
> header('Location: thanks.php');
>
> ?>
> -
>
>
> = = = Original message = = =
>
> when I add that code I can the following error msg when submitting the
> form.
> " *Warning*: Cannot modify header information - headers already sent by
> (output started at /home/webadmin/dedicated75.virtual.vps-
> host.net/html/fortuneInteractive/Consultation_test.php:6<http://host.net/html/fortuneInteractive/Consultation_test.php:6>
> <http://host.net/html/fortuneInteractive/Consultation_test.php:6>)
> in */home/webadmin/dedicated75.virtual.vps-
> host.net/html/fortuneInteractive/Consultation_test.php<http://host.net/html/fortuneInteractive/Consultation_test.php>
> <http://host.net/html/fortuneInteractive/Consultation_test.php>
> * on line *168* "
> line 168 is the one with header( 'Location: thanks.php' );
> on it.
> can anyone explain why this is happening and how to rectify?
> TIA
>
> On 10/5/05, Robert Cummings <[EMAIL PROTECTED]> wrote:
> >
> > On Wed, 2005-10-05 at 21:15, Bruce Gilbert wrote:
> > > thanks for the reply.
> > >
> > > and where on the page would that need to go? Within the head tags?
> > > and would it need to be within 
> >
> > Right after this line:
> >
> > mail ($to, $subject, $msg, $mailheaders);
> >
> > And you will already be within PHP interpretation.
> >
> > Cheers,
> > Rob.
> > --
> > ..
> > | InterJinn Application Framework - http://www.interjinn.com |
> > ::
> > | An application and templating framework for PHP. Boasting |
> > | a powerful, scalable system for accessing system services |
> > | such as forms, properties, sessions, and caches. InterJinn |
> > | also provides an extremely flexible architecture for |
> > | creating re-usable components quickly and easily. |
> > `'
> >
> >
>
>
> --
> ::Bruce::
>
>
> ___
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.
>
>


--
::Bruce::


Re: [PHP] Re: form not submitting when I change action from PHP_SELF to thanks page

2005-10-06 Thread Bruce Gilbert
when I put the die statment in and test the form I get, the html prior to
the form and what I put in my die statement eg:"made it to this point". The
form submits and I get the info, but I am not redirected to the Thanks page.

 My question is how do I determine from this what is causing my error?

 On 10/6/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:
>
> You don't have to put anything specific, it just stops the script from
> executing.
>
> You can optionally put text in there. I like using die() for some reason
> (shorter? more.. err.. aggressive? hah) so I'll using commands like:
>
> die("Made it to this point...");
>
> I might use this to see if I got to a certain conditional or not..
>
> Anyway, if you're getting that error, then there's definitely something
> being sent before the header() is executed.
>
> Check any require() or include() files, check all the code above your
> header() statement. So far I've never seen or heard of any bugs with
> header() where it'd mysteriously bomb out in this manner, it's always been
> something output and it's always been something people kick themselves for
> not seeing before. hah
>
> Keep looking, you'll find it.
>
> -TG
>
> = = = Original message = = =
>
> I checked and no white space involved. What would I need to put tin the
> exit()/die() function?
>
> --
> ::Bruce::
>
>
> ___
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.
>
>


--
::Bruce::


[PHP] a couple of problems with PHP form

2005-10-16 Thread Bruce Gilbert
I am trying to set up some validation for my php form with the email
field using the following code:

if(!eregi("^(.+)@(.+)\\.(.+)$",$_POST['email']))
{
 $error_msg .= "Your email appears to be invalid.";
 $ok = "false";
}


I am trying to accomplish not being able to enter anything other than
a valid email string
this doesn'r seem to be doing anything.

also, I want the field to appear hilighted when there is no
information so I am doing this:


"

and I have an error class set up in my CSS, such as

 .error {border: 1px solid red;}

this is not doinf anything either.

Can somone point out what may be wrong with this PHP code?

thanks,

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



[PHP] re: some problems with php form

2005-10-17 Thread Bruce Gilbert
-- Forwarded message --
From: "Richard Lynch" <[EMAIL PROTECTED]>
To: "Mark Rees" <[EMAIL PROTECTED]>
Date: Mon, 17 Oct 2005 15:12:50 -0500 (CDT)
Subject: Re: [PHP] Re: a couple of problems with PHP form
On Mon, October 17, 2005 5:32 am, Mark Rees wrote:
> -
> sorry, my editor has not indented again
> -
> also, I want the field to appear hilighted when there is no
> information so I am doing this:
>
>  "normal"; } id="firstname" name="firstname" type="text"
> value="{$_POST['firstname']}"? />"
I think the quote mark balancing is messed up here...
>"

in the css:

input.error {
border: 2px inset red;
margin:0;
font-family: arial, helvetica, sans-serif;
color: #036;
width: 15em;
padding-left: .25em;
font-weight: bold;
background: #eee;
}

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



Re: [PHP] re: some problems with php form

2005-10-18 Thread Bruce Gilbert
Minuk,
 your revisions gives me an error:
 *Parse error*: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting
T_STRING or T_VARIABLE or T_NUM_STRING in *
/hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form_test.php<http://evolution.com/Contact_Form_test.php>
* on line *63*
 -Bruce

 On 10/17/05, Minuk Choi <[EMAIL PROTECTED]> wrote:
>
> Wait a minute... you meant
>
>  }
> else
> {
> echo "input.normal";
> }
> ?>" id="firstname" name="firstname" type="text" value=" $_POST['firstname'];?>">
>
>
> ...or am I looking at the wrong thing?
>
> Bruce Gilbert wrote:
>
> >-- Forwarded message --
> >From: "Richard Lynch" <[EMAIL PROTECTED]>
> >To: "Mark Rees" <[EMAIL PROTECTED]>
> >Date: Mon, 17 Oct 2005 15:12:50 -0500 (CDT)
> >Subject: Re: [PHP] Re: a couple of problems with PHP form
> >On Mon, October 17, 2005 5:32 am, Mark Rees wrote:
> >
> >
> >>-
> >>sorry, my editor has not indented again
> >>-
> >>also, I want the field to appear hilighted when there is no
> >>information so I am doing this:
> >>
> >> >>"normal"; } id="firstname" name="firstname" type="text"
> >>value="{$_POST['firstname']}"? />"
> >>
> >>
> >I think the quote mark balancing is messed up here...
> >
> >
> >> >"input.normal"; } id="firstname" name="firstname" type="text"
> >value="{$_POST['firstname']}"? />"
> >
> >in the css:
> >
> >input.error {
> > border: 2px inset red;
> > margin:0;
> > font-family: arial, helvetica, sans-serif;
> > color: #036;
> > width: 15em;
> > padding-left: .25em;
> > font-weight: bold;
> > background: #eee;
> >}
> >
> >
> >
>



--
::Bruce::


Re: [PHP] re: some problems with php form

2005-10-18 Thread Bruce Gilbert
I think so Minuk. Here is the *entire* form code below. Maybe someone can
also point out why the email regex validation code isn't working?
 TIA
 /begin PHP form
code*/



About You

* First Name: 

" id="firstname" name="firstname" type="text" value="">

* Last Name:



* Company: 



* Phone: 



* e-mail: 



* re-enter e-mail:





More Info.
*
URL:http://mail.google.com/mail//>

 

* Best way to
reach:


email
phone
snail mail




* Best time to
contact:



morning
evening
anytime





Send us a detailed
message specifying what you wish to accomplish with your web site.






* indicates a required field (all fields are
required).
END_FORM;
if ($_POST['op']!='ds') {
echo "$form_block";
} else if ($_POST["op"] == "ds") {

//Function saves time and space by eliminating unneccesary code
function check($fieldname)
{
global $err_msg;
if($_POST[$fieldname] == "")
{
if ( !isset($err_msg)) { $err_msg = "You haven't entered
your ".$fieldname."!"; }
elseif ( isset($err_msg)) { $err_msg="You haven't entered
your ".$fieldname."!"; }
}
return $err_msg;
}

if(!eregi("^(.+)@(.+)\\.(.+)$",$_POST['email']))
{
$error_msg .= "Your email appears to be invalid.";
$ok = "false";
}

 //
///Function execution/
//

check('firstname');
check('lastname');
check('company');
check('phone');
check('email');
check('email2');
check('URL');
check('Contact_Preference');
check('Contact_Time');
check('message');

//Validating Email Address
if ($_POST['email'] != $_POST['email2']) { $email_err = "\ne-mail address fields do not match!"; }

if (isset($err_msg) || isset($email_err)) { echo
$err_msg.$email_err."\n\n".$form_block; }
else {
//it's ok to send, so build the mail
$msg = "E-mail sent from
www.inspired-evolution.com\n<http://www.inspired-evolution.com/n>
";
$msg .="Sender's first name: {$_POST['firstname']}\n";
$msg .="Sender's last name: {$_POST['lastname']}\n";
$msg .="Company name: {$_POST['company']}\n";
$msg .="Senders Phone number: {$_POST['phone']}\n";
$msg .="Senders email address: {$_POST['email']}\n";
$msg .="Senders email address (re-typed): {$_POST['email2']}\n";
$msg .="The website is : {$_POST['URL']}\n";
$msg .="I prefer to be contacted via: {$_POST['Contact_Preference']}\n";
$msg .="The Best time to contact is: {$_POST['Contact_Time']}\n";
$msg .="Message: {$_POST['message']}\n\n";
$to ="[EMAIL PROTECTED]";
$subject ="There has been a disturbance in the force";
$mailheaders ="From: Inspired-Evolution.com
<http://www.inspired-evolution.com>\n <http://www.inspired-evolution.com>/n>
";
$mailheaders .="Reply-To: {$_POST['email']}\n";
//send the mail
mail ($to, $subject, $msg, $mailheaders);
//display information to user
echo "Hola, $firstname!.
We have received your request for a web site review , and will respond
shortly.
Thanks for visiting inspired-evolution.com
<http://inspired-evolution.com>and have a wonderful day!
Regards,
Inspired Evolution";
}

}
?>
/end PHP form
code*/


 On 10/18/05, Minuk Choi <[EMAIL PROTECTED]> wrote:
>
> Can you post your Contact_Form_test.php?
>
>  }
> else
> {
> echo "input.normal";
> }
> ?>" id="firstname" name="firstname" type="text" value=" $_POST['firstname'];?>">
>
> should parse into HTML by PHP. This block, I am assuming is placed in a
> HTML tag and not in a 
>
>
> Bruce Gilbert wrote:
>
> >Minuk,
> > your revisions gives me an error:
> > *Parse error*: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
> expecting
> >T_STRING or T_VARIABLE or T_NUM_STRING in *
> >/hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form_test.php<http://evolution.com/Contact_Form_test.php>
> <http://evolution.com/Contact_Form_test.php>
> >* on line *63*
> > -Bruce
> >
> > On 10/17/05, Minuk Choi <[EMAIL PROTECTED]> wrote:
> >
> >
> >>Wait a minute... you meant
> >>
> >> >>}
> >>else
> >>{
> >>echo "input.normal";
> >>}
> >>?>&q

Re: [PHP] re: some problems with php form

2005-10-19 Thread Bruce Gilbert
Mike and all,
 guess I still have something wrong as I am getting this error:
 *Parse error*: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting
T_STRING or T_VARIABLE or T_NUM_STRING in *
/hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form.php<http://evolution.com/Contact_Form.php>
* on line *52*
  line 52 is:
 " id="firstname" name="firstname" type="text" value="">
  how would I fix this error?

 On 10/18/05, Ford, Mike <[EMAIL PROTECTED]> wrote:
>
> On 18 October 2005 15:50, Bruce Gilbert wrote:
>
> > I think so Minuk. Here is the *entire* form code below. Maybe
> > someone can
> > also point out why the email regex validation code isn't working? TIA
> > /begin PHP form
> > code*/
> >
> >  > $form_block=<<
> Here starteth a heredoc ;)
>
> >  > class="info_request" > 
> > About You
> >
> > * First
> > Name:  > />
> >
> > 
> Here you try to start a block of PHP code within the heredoc. You can't do
> that.
>
> Because you didn't show us the heredoc, most of the responses assumed you
> had broken out of PHP completely into HTML, which is why many of the
> solutions produced parse errors.
>
> > input.normal";}?>" id="firstname" name="firstname"
> > type="text" value=" > echo $_POST['firstname'];?>">
>
> Again, you're trying to use PHP code inside a heredoc -- this one's
> solvable, though: as you just want the value of the variable, you can use
> {$_POST['firstname']} (which I notice you do elsewhere!).
>
> Actually, since you use the heredoc's value once almost immediately after
> assigning it, I think you probably would be better breaking out into PHP for
> most of this, thusly:
>
> if ($_POST['op']!='ds') {
>
> ?>
>  class="info_request" >
> 
> About You
>
> * First Name:
> 
>
>  else {echo "normal"}
> ?>" id="firstname" name="firstname" type="text" value=" echo $_POST['firstname'] ?>">
>
> ... etc. ...
>
>  } else if ($_POST["op"] == "ds") {
>
> Hope this helps.
>
> Cheers!
>
> Mike
>
> -
> Mike Ford, Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Headingley Campus, LEEDS, LS6 3QS, United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
>
>
> To view the terms under which this email is distributed, please go to
> http://disclaimer.leedsmet.ac.uk/email.htm
>



--
::Bruce::


Re: [PHP] re: some problems with php form

2005-10-19 Thread Bruce Gilbert
I now have:

* First Name: 
"
id="firstname" name="firstname" type="text" value="">



but I still receive the same error:
 ' *Parse error*: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting T_STRING or T_VARIABLE or T_NUM_STRING in *
/hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form.php
* on line *54 '*

 On 10/19/05, Jay Blanchard <[EMAIL PROTECTED]> wrote:
>
> [snip]
> "
> id="firstname" name="firstname" type="text" value=" $_POST['firstname'] ?>">
>
> how would I fix this error?
> [/snip]
>
> You are missing several semi-colons;
>
>  "normal";}?>"
> id="firstname" name="firstname" type="text" value=" $_POST['firstname']; ?>">
>



--
::Bruce::


[PHP] emailing MySQL list not working

2005-11-11 Thread Bruce Gilbert
Hello,

I am using a template for an email database. This has a MySQL database
where the end user can sign up to receive my email newsletter, They
subscribe and are entered into a MySQL database that I have set up.
Everything works fine as far as  being entered into the dataase The
problem occurs when I send a test email to the database list. (I am
sending one to myself). The email never gets sent!

the code to send out the email from the MySQL database list is as follows:

\n"; //put your name and
sending address here
$reply_to = "<[EMAIL PROTECTED]>\n"; //reply-to, insert your address
here,  might not be supported by your server
$return_path = "[EMAIL PROTECTED]"; // return-path, if you have
one, also might not be supported by your server
$x_sender = "<[EMAIL PROTECTED]>\n"; //your address, another setting
possibly not supported by your server

$message .= "\n\n This is a double opt-in mailing list. All recipients
have confirmed their subscription. If you no longer wish to receive
these emails, please go to http://$list_owner_domain_name \n
Get this custom mailing list system for 
your site. Go to
http://www.karlcore.com for more info! \n";

// this selects the table and orders the results by the name
// it only selects the listings that have been confirmed
$query = "
SELECT
*
FROM
mailinglist
WHERE
subscribe=1
AND
confirmed=1";

$result = mysql_query($query);

while ( $row = mysql_fetch_array($result))
{
$rec_id = $row["rec_id"];
$email = $row["email"];

$recipient = $email;

$headers = "From: $sender";
$headers .= "Reply-To: $reply_to";
$headers .= "Return-Path: $return_path";
$headers .= "X-Sender: $x_sender";
$headers .= "X-Mailer: PHP4\n"; //mailer
$headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
$headers .= "Mime-Version:1.0\n Content-Type: text/plain;
charset=\"iso-8859-1\nContent-Transfer-Encoding: 8bit\n";

mail( $recipient, $subject, stripslashes($message), $headers );
sleep(1);

}

// run second query to automatically dump unsubscribed email addresses.
$query2 = "
DELETE FROM
mailinglist
WHERE
subscribe='0'
AND
confirmed='0' ";

//run the query
mysql_query($query2, $link) or die (mysql_error());

mysql_close();

header("location: mailsent.php");
exit;
?>

The form is located here:

http://www.inspired-evolution.com/sendmailform.php

let me know if I need to provide any more information.

Thanks!

Bruce Gilbert

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



[PHP] Re: emailing MySQL list not working

2005-11-12 Thread Bruce Gilbert
I don't suppose you meant like this : $headers = "From: 
$sender";("\r\n").
or is it without the ( )?

thanks

On 11/12/05, Marco Kaiser <[EMAIL PROTECTED]> wrote:
> Hi,
>
> try to add in your $headers linebreaks. ("\r\n").
>
> -- Marco
>
> > $headers = "From: $sender";
> > $headers .= "Reply-To: $reply_to";
> > $headers .= "Return-Path: $return_path";
> > $headers .= "X-Sender: $x_sender";
> > $headers .= "X-Mailer: PHP4\n"; //mailer
> > $headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
> > $headers .= "Mime-Version:1.0\n Content-Type: text/plain;
> > charset=\"iso-8859-1\nContent-Transfer-Encoding: 8bit\n";
>


--
::Bruce::

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



[PHP] please shed some light on SQLsyntax error

2005-11-13 Thread Bruce Gilbert
I am trying to set up a contact list database using guidance from a
PHP/MySQL book I recenty purchased, and not aving done this before I
am not sure what the following error means or where I shoudl look for
this kind of error. I have a table set up in MySQL using PHPMyadmin,
and I am thinking it may be something in my table? Please let me know
if anyone lese is familiar of this type of error below:

"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 'List values ('', 'firstname', 'lastname', 'address', '


thanks in advance,

Bruce Gilbert

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



[PHP] Re: please shed some light on SQLsyntax error

2005-11-13 Thread Bruce Gilbert
>You would need to show us the SQL that was causing that error. Otherwise
>it is fairly meaningless.

hope this helps...

http://www.inspired-evolution.com/show_addcontact.php";);
exit;
}else {
//if form variables are present,start a session
session_start();
}

//check for validity of user
if ($_SESSION[valid] != "yes") {
header("Location:http://www.inspired-evolution.com/contact_menu.php";);
exit;
}

//set up table and database names
$db_name ="bruceg_contactlist";
$table_name ="Contact List";

//connect to server and select database
$connection = @mysql_connect("69.90.6.198","database_username","password")
or die(mysql_error());
$db = @mysql_select_db($db_name,$connection) or die(mysql_error());

//build and issue query
$sql = "INSERT INTO $table_name values ('', '$_POST[f_name]',
'$_POST[l_name]', '$_POST[address1]', '$_POST[address2]',
'$_POST[address3]', '$_POST[postcode]', '$_POST[country]',
'$_POST[prim_tel]', '$_POST[sec_tel]', '$_POST[email]',
'$_POST[birthday]')";

$result = @mysql_query($sql,$connection)or die(mysql_error());

?>

On 11/13/05, Jasper Bryant-Greene <[EMAIL PROTECTED]> wrote:
> Bruce Gilbert wrote:
> > I am trying to set up a contact list database using guidance from a
> > PHP/MySQL book I recenty purchased, and not aving done this before I
> > am not sure what the following error means or where I shoudl look for
> > this kind of error. I have a table set up in MySQL using PHPMyadmin,
> > and I am thinking it may be something in my table? Please let me know
> > if anyone lese is familiar of this type of error below:
> >
> > "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 'List values ('', 'firstname', 'lastname', 'address', '
>
> You would need to show us the SQL that was causing that error. Otherwise
> it is fairly meaningless.
>
> Jasper
>


--
::Bruce::

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



[PHP] Re: please shed some light on SQLsyntax error

2005-11-13 Thread Bruce Gilbert
for the table name you mean like this?

$table_name =" 'Contact List' ";

On 11/13/05, Jasper Bryant-Greene <[EMAIL PROTECTED]> wrote:
> Bruce Gilbert wrote:
> >> You would need to show us the SQL that was causing that error. Otherwise
> >> it is fairly meaningless.
> >
> > hope this helps...
> >
> >  >
> > //check for required form variables
> > if ((!$_POST[f_name]) || (!$_POST[l_name])) {
>
> Unrelated, but you should have quotes here. Like $_POST['f_name']
>
> >
>   
> header("Location:http://www.inspired-evolution.com/show_addcontact.php";);
>
> There should also probably be a space between the : and the start of the
>   URL here.
>
> > exit;
> > }else {
> > //if form variables are present,start a session
> > session_start();
> > }
> >
> > //check for validity of user
> > if ($_SESSION[valid] != "yes") {
>
> Again, quotes on the array subscript.
>
> > header("Location:http://www.inspired-evolution.com/contact_menu.php";);
>
> And space between colon and URL here.
>
> > exit;
> > }
> >
> > //set up table and database names
> > $db_name ="bruceg_contactlist";
> > $table_name ="Contact List";
> >
> > //connect to server and select database
> > $connection =
> @mysql_connect("69.90.6.198","database_username","password")
> > or die(mysql_error());
> > $db = @mysql_select_db($db_name,$connection) or die(mysql_error());
> >
> > //build and issue query
> > $sql = "INSERT INTO $table_name values ('', '$_POST[f_name]',
>
> You'll be wanting to put backticks (`) around the table name, because it
> contains a space.
>
> Jasper
>


--
::Bruce::

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



[PHP] Re: emailing MySQL list not working

2005-11-14 Thread Bruce Gilbert
Sorry for the newbie question...

I did a search on php.net but didn't find my answer.

what does \r\n do as opposed to just \n?

and yes, I know what  \n does.


On 11/14/05, Richard Lynch <[EMAIL PROTECTED]> wrote:
> On Fri, November 11, 2005 9:33 pm, Bruce Gilbert wrote:
> > $headers = "From: $sender";
> > $headers .= "Reply-To: $reply_to";
> > $headers .= "Return-Path: $return_path";
>
> > $headers .= "X-Sender: $x_sender";
> > $headers .= "X-Mailer: PHP4\n"; //mailer
>
> These two may trip some spam filters.
>
> > $headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
>
> Setting this at all probably trips a few spam filters.
>
> > $headers .= "Mime-Version:1.0\n Content-Type: text/plain;
> > charset=\"iso-8859-1\nContent-Transfer-Encoding: 8bit\n";
> >
> > mail( $recipient, $subject, stripslashes($message), $headers );
>
> Check the return error code!!!
> http://php.net/mail
>
> > sleep(1);
>
> Just how many emails are you trying to send with mail()?
>
> http://php.net/mail was never designed for heavy-volume lists...
>
> Look into http://phpclasses.org for something that WAS designed to
> handle the volume you need.
>
> > }
> >
> > // run second query to automatically dump unsubscribed email
> > addresses.
>
>
> > $query2 = "
> > DELETE FROM
> > mailinglist
> > WHERE
> > subscribe='0'
> > AND
> > confirmed='0' ";
> >
> > //run the query
> > mysql_query($query2, $link) or die (mysql_error());
>
> Dude, if I unsubscribed, get me off the list *BEFORE* you send out
> another email, not after.
>
> --
> Like Music?
> http://l-i-e.com/artists.htm
>
>
>


--
::Bruce::

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