[PHP] still having trouble with time-stamp subtraction two mysql fields
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. html head titleExam Results/title /head body ?php include(includes/functions.php); ? h1 class=resultsexam results/h1 table id=results trthCandidate Name/th/tr ?php ini_set(display_errors,1); ERROR_REPORTING(E_ALL); $conn = mysql_connect(localhost,uname,pw); if (!$conn) { echo Unable to connect to DB: . mysql_error(); exit; } if (!mysql_select_db(MyDB)) { echo Unable to select mydbname: . mysql_error(); exit; } $sql = SELECT Responses.name,Answer1,Answer2,Answer3,Answer4,Answer5,Answer6,Answer7,Answer8,Answer9,Answer10,Answer11,Answer12 FROM Responses ; $result = mysql_query($sql); if (!$result) { echo Could not successfully run query ($sql) from DB: . mysql_error(); exit; } if (mysql_num_rows($result) == 0) { echo No rows found, nothing to print so am exiting; exit; } while ($row = mysql_fetch_assoc($result)) { echo trtd class='name'{$row['name']}/td/tr; echo trtd class='section'strongSection 1/strong/td/tr; for ($i =1;$i9;++$i) { echo trtd{$row['Answer'.$i]}/td/tr; } echo trtd class='section'strongSection 2/strong/td/tr; echo trtd{$row['Answer10']}/td/tr; echo trtd class='section'strongSection 3/strong/td/tr; echo trtd{$row['Answer11']}/td/tr; echo trtd class='section'strongSection 4/strong/td/tr; echo trtd{$row['Answer12']}/td/tr; $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 trth class='complete'Completion Time:/th/trtrtd\n; echo $formatted_completion_time; echo /td/tr; } } mysql_free_result($result); ? /table /body /html and my function code for the subtracting of the two fields is here: ?php function formatTime($cTime){ if($cTime 60){ //less than 1 minute show seconds $formatted_completion_time = date(s,$cTime). seconds; }elseif($cTime 3600){ //1 hour $formatted_completion_time = date(i,$cTime). minutes; }elseif($cTime 86400){ //24 hours $formatted_completion_time = date(H:i,$cTime). hours; }else{ $formatted_completion_time = round($cTime/86400,0). days; } return $formatted_completion_time; } ? 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] determining time difference between two timestamp fields.
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 trthCompletion Time:/th/trtrtd . date('F j, Y g:i:sa', strtotime($row[login_timestamp])) . /td/tr; 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.
Thanks. I know my syntax isn't quite right, but is this close to what I need to do? echo trthCompletion Time:/th/trtrtd . date('F j, Y g:i:sa', strtotime($row[login_timestamp] - [submit_timestamp])/60) . /td/tr; On Tue, May 25, 2010 at 10:01 AM, Peter Lind peter.e.l...@gmail.com wrote: On 25 May 2010 15:55, Bruce Gilbert webgu...@gmail.com 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 trthCompletion Time:/th/trtrtd . date('F j, Y g:i:sa', strtotime($row[login_timestamp])) . /td/tr; 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 -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind BeWelcome/Couchsurfing: Fake51 Twitter: http://twitter.com/kafe15 /hype -- ::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.
Here is what I currently have. echo trthCompletion Time:/th/trtrtd . (strtotime($row['submit_timestamp']) - strtotime($row['login_timestamp']))/60 , /td/tr; 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 peter.e.l...@gmail.com wrote: On 25 May 2010 16:14, Bruce Gilbert webgu...@gmail.com wrote: Thanks. I know my syntax isn't quite right, but is this close to what I need to do? echo trthCompletion Time:/th/trtrtd . date('F j, Y g:i:sa', strtotime($row[login_timestamp] - [submit_timestamp])/60) . /td/tr; 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 peter.e.l...@gmail.com wrote: On 25 May 2010 15:55, Bruce Gilbert webgu...@gmail.com 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 trthCompletion Time:/th/trtrtd . date('F j, Y g:i:sa', strtotime($row[login_timestamp])) . /td/tr; 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 -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind BeWelcome/Couchsurfing: Fake51 Twitter: http://twitter.com/kafe15 /hype -- ::Bruce:: -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind BeWelcome/Couchsurfing: Fake51 Twitter: http://twitter.com/kafe15 /hype -- ::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
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] converting video formats
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] form not submitting inofrmation
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] ?php include(emailval.php); $site_name = Inspired-Evolution.com; $site_owner_email = [EMAIL PROTECTED]; $your_domain = www.inspired-evolution.com; $current_url = $_SERVER['REQUEST_URI']; $submit = $_REQUEST['submit']; if(isset($submit)){ $name = $_REQUEST['name']; $flizzum_flazzum = $_REQUEST['flizzum_flazzum']; $subject = $_REQUEST['subject']; $msg = $_REQUEST['msg']; if(strlen($name) 2){ $name_warn = true; } if (MailVal($flizzum_flazzum, 2)){ $email_warn = true; } if(strlen($msg) 2){ $msg_warn = true; } if (preg_match(/$your_domain/i, $flizzum_flazzum)) { $bogus_warn = true; } if((!isset($name_warn)) (!isset($email_warn)) (!isset($bogus_warn)) (!isset($msg_warn))){ // headers for the email listed below $headers .= From: $name $flizzum_flazzum\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(h3 class='thanks' Hola $name, Thanks for getting in touch!/h3 pWe have received your e-mail and will respond at em$flizzum_flazzum/em/p/div); exit; } } ? [/php] emailval.php is [php] ?php // hardcore e-mail validation function MailVal($Addr, $Level, $Timeout = 15000) { // Valid Top-Level Domains $gTLDs = com:net:org:edu:gov:mil:int:arpa:; $CCs = ad:ae:af:ag:ai:al:am:an:ao:aq:ar:as:at:au:aw:az:ba:bb:bd:be:bf:. bg:bh:bi:bj:bm:bn:bo:br:bs:bt:bv:bw:by:bz:ca:cc:cf:cd:cg:ch:ci:. ck:cl:cm:cn:co:cr:cs:cu:cv:cx:cy:cz:de:dj:dk:dm:do:dz:ec:ee:eg:. eh:er:es:et:fi:fj:fk:fm:fo:fr:fx:ga:gb:gd:ge:gf:gh:gi:gl:gm:gn:. gp:gq:gr:gs:gt:gu:gw:gy:hk:hm:hn:hr:ht:hu:id:ie:il:in:io:iq:ir:. is:it:jm:jo:jp:ke:kg:kh:ki:km:kn:kp:kr:kw:ky:kz:la:lb:lc:li:lk:. lr:ls:lt:lu:lv:ly:ma:mc:md:mg:mh:mk:ml:mm:mn:mo:mp:mq:mr:ms:mt:. mu:mv:mw:mx:my:mz:na:nc:ne:nf:ng:ni:nl:no:np:nr:nt:nu:nz:om:pa:. pe:pf:pg:ph:pk:pl:pm:pn:pr:pt:pw:py:qa:re:ro:ru:rw:sa:sb:sc:sd:. se:sg:sh:si:sj:sk:sl:sm:sn:so:sr:st:su:sv:sy:sz:tc:td:tf:tg:th:. tj:tk:tm:tn:to:tp:tr:tt:tv:tw:tz:ua:ug:uk:um:us:uy:uz:va:vc:ve:. vg:vi:vn:vu:wf:ws:ye:yt:yu:za:zm:zr:zw:; // The countries can have their own 'TLDs', e.g. mydomain.com.au $cTLDs = com:net:org:edu:gov:mil:co:ne:or:ed:go:mi:; $fail = 0; // Shift the address to lowercase to simplify checking $Addr = strtolower($Addr); // Split the Address into user and domain parts $UD = explode(@, $Addr); if (sizeof($UD) != 2 || !$UD[0]) $fail = 1; // Split the domain part into its Levels $Levels = explode(., $UD[1]); $sLevels = sizeof($Levels); if ($sLevels 2) $fail = 1; // Get the TLD, strip off trailing ] } ) 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] variables in CSS in PHP question/problems
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] ?php /** * * create our font class. * **/ class font { /** CONSTRUCTOR * * In PHP 4 your constructor has to have the same name as the class * in PHP 5 it would be thus: * * function __construct($args=array()) { * $this-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: div class=image_floatnbsp;/div and of course a body tag. in my css I have: div.image_float{ background-image: url(?php rotater(); ?) no-repeat; float:left; width:75px; height:75px; padding:15px; } and also body { background-color: ?php echo $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] help with script needed
I have a little script that prints a number out from 1 to 100 [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; } ? [/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
Thanks for the responses so far. This is what I have come up with [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; 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 martin@bugs.unl.edu.ar 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] can this be fone with PHP?
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 setting menu styles with PHP
am trying to accomplish something utlizing PHP. What I have is a menu marked up as such: div id=navcontainer ul id=navlist li id=activea href=About_Me.php title=you know you want to learn more about me id=currentAbout Me/a/li lia href=Skillset.php title=I've got skillzSkill set/a/li lia href=Hireme.php title=I can do wonders for your web presenceHire Me/a/li lia href=Portfolio.php title=web sites, graphics, newslettersPortfolio/a/li lia href=Contact.php title=how to get in touch with meContact/a/li lia href=Resume.php title=my beautiful resumeReacute;sumeacute;/a/li lia href= http://inspiredevolution.blogs.com/inspiredevolutioncom/; title=the blog for Inspired-Evolution.com Blog/a/li li class=lasta href=RSS.php title=Syndication that is really simple RSS/a/li /ul /div 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 code not functioning on search page
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] recommendations for good breacrumbs script
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] Re: emailing MySQL list not working
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
[PHP] please shed some light on SQLsyntax error
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
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])) { header(Location: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
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
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] emailing MySQL list not working
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: ?php // this script is used to as the action for the form on sendmailform.php // it sends the email to all persons who have subscribed to the mailinglist and confirmed their subscription //include the config file include(config.php); $subject = $_REQUEST['subject']; $message = $_REQUEST['message']; //Variables for the headers // customize this stuff $sender = Bruce Gilbert [EMAIL PROTECTED]\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
Re: [PHP] re: some problems with php form
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.phphttp://evolution.com/Contact_Form.php * on line *52* line 52 is: input class=?PHP if ($error_msg) {echo error} else {echo normal} ? id=firstname name=firstname type=text value=?php echo $_POST['firstname'] ? 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*/ ?php $form_block=END_FORM Here starteth a heredoc ;) form method=post action={$_SERVER['PHP_SELF']} class=info_request fieldset class=left legend title=About YouAbout You/legend plabel for=firstnamespan class=red*/span First Name: /labelbr / input class=?PHP if ($error_msg){echo input.error;}else{echo 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=?PHP 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') { ? form method=post action=?php echo $_SERVER['PHP_SELF'] ? class=info_request fieldset class=left legend title=About YouAbout You/legend plabel for=firstnamespan class=red*/span First Name: /labelbr / input class=?PHP if ($error_msg) {echo error} else {echo normal} ? id=firstname name=firstname type=text value=?php echo $_POST['firstname'] ? ... etc. ... ?php } 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
I now have: plabel for=firstnamespan class=red*/span First Name: /labelbr / input class=?PHP if ($error_msg) {echo error;} else {echo normal;}? id=firstname name=firstname type=text value=?php echo $_POST[firstname;]; ? /p 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.phphttp://evolution.com/Contact_Form.php * on line *54 '* On 10/19/05, Jay Blanchard [EMAIL PROTECTED] wrote: [snip] input class=?PHP if ($error_msg) {echo error} else {echo normal}? id=firstname name=firstname type=text value=?php echo $_POST['firstname'] ? how would I fix this error? [/snip] You are missing several semi-colons; input class=?PHP if ($error_msg) {echo error;} else {echo normal;}? id=firstname name=firstname type=text value=?php echo $_POST['firstname']; ? -- ::Bruce::
Re: [PHP] re: some problems with php form
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.phphttp://evolution.com/Contact_Form_test.php * on line *63* -Bruce On 10/17/05, Minuk Choi [EMAIL PROTECTED] wrote: Wait a minute... you meant input class= ?PHP if ($error_msg) { echo input.error; } else { echo input.normal; } ? id=firstname name=firstname type=text value=?PHP echo $_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: input class=? if($error_msg){ echo error; } ELSE { echo normal; } id=firstname name=firstname type=text value={$_POST['firstname']}? / I think the quote mark balancing is messed up here... input class= this starts a quote for the class= There appears to be no ending quote for that... It may simply have been lost in email editing, however... adding the input.error didn't solve the problem dang it.! If there is a ending quote missing, I don't see it right off hand. I know have: input class=? if($error_msg){ echo input.error; } ELSE { echo 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
$_POST['firstname'];? should parse into HTML by PHP. This block, I am assuming is placed in a HTML tag and not in a ?PHP block, correct? 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.phphttp://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 input class= ?PHP if ($error_msg) { echo input.error; } else { echo input.normal; } ? id=firstname name=firstname type=text value=?PHP echo $_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: input class=? if($error_msg){ echo error; } ELSE { echo normal; } id=firstname name=firstname type=text value={$_POST['firstname']}? / I think the quote mark balancing is messed up here... input class= this starts a quote for the class= There appears to be no ending quote for that... It may simply have been lost in email editing, however... adding the input.error didn't solve the problem dang it.! If there is a ending quote missing, I don't see it right off hand. I know have: input class=? if($error_msg){ echo input.error; } ELSE { echo 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:: -- ::Bruce::
[PHP] re: some problems with php form
-- 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: input class=? if($error_msg){ echo error; } ELSE { echo normal; } id=firstname name=firstname type=text value={$_POST['firstname']}? / I think the quote mark balancing is messed up here... input class= this starts a quote for the class= There appears to be no ending quote for that... It may simply have been lost in email editing, however... adding the input.error didn't solve the problem dang it.! If there is a ending quote missing, I don't see it right off hand. I know have: input class=? if($error_msg){ echo input.error; } ELSE { echo 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; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] a couple of problems with PHP form
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 .= BR /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: input class=? if($error_msg){ echo error; } ELSE { echo normal; } id=firstname name=firstname type=text value={$_POST['firstname']}? / 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
Re: [PHP] Re: form not submitting when I change action from PHP_SELF to thanks page
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:6http://host.net/html/fortuneInteractive/Consultation_test.php:6) in */home/webadmin/dedicated75.virtual.vps- host.net/html/fortuneInteractive/Consultation_test.phphttp://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 ?php ? 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
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. - ?php // This should work because there's no output or white space above header() header('Location: thanks.php'); ? - - ?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:6http://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.phphttp://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 ?php ? 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
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] form not submitting when I change action from PHP_SELF to thanks page
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: form action=thanks.php method=POST 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: ?php $form_block=END_FORM form method=post action={$_SERVER['PHP_SELF']} class=info_request fieldset class=left legend title=About YouAbout You/legend plabel for=firstnamespan class=red*/span First Name: /labelbr / input id=firstname name=firstname type=text value={$_POST['firstname']} //p plabel for=lastnamespan class=red*/span Last Name:/labelbr / input id=lastname name=lastname type=text value={$_POST['lastname']} //p plabel for=companyspan class=red*/span Company: /labelbr / input id=company name=company type=text value={$_POST['company']} //p plabel for=phonespan class=red*/span Phone: /labelbr / input id=phone name=phone type=text value={$_POST['phone']} //p plabel for=emailspan class=red*/span e-mail: /labelbr / input id=email name=email type=text value={$_POST['email']} //p plabel for=email2span class=red*/span re-enter e-mail: /labelbr / input id=email2 name=email2 type=text value={$_POST['email2']} //p /fieldset fieldset legend title=More Info.More Info./legend plabel for=URLspan class=red*/span URL:/labelbr / input id=URL type=text name=URL value={$_POST['URL']}/ /p plabel for=Contact_Preferencespan class=red*/span Best way to reach:/labelbr / select name=Contact_Preference id=Contact_Preference option value=emailemail/option option value=phonephone/option option value=snail_mailsnail mail/option /select /p plabel for=Contact_Timespan class=red*/span Best time to contact:/labelbr / select name=Contact_Time id=Contact_Time option value=morningmorning/option option value=eveningevening/option option value=anytimeanytime/option /select/p input type=hidden name=op value=ds / textarea name=message id=message rows= cols= Send us a detailed message specifying what you wish to accomplish with your web site. /textarea input class=submit src=/images/submit.gif alt=Submit type=image name=submit / /fieldset /form /div pspan class=red*/span indicates a required field (all fields are required)./p 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 = span class='red'You haven't entered your .$fieldname.!/spanbr /; } elseif ( isset($err_msg)) { $err_msg=span class='red'You haven't entered your .$fieldname.!/spanbr /; } } 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 = \nspan class='red'e-mail address fields do not match!/span; } 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 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 pHola, strong$firstname/strong!.br /br / We have received your request for a web site review , and will respond shortly.br / Thanks for visiting inspired-evolution.com and have a wonderful day!br /br / Regards,br /br / strongInspired Evolution/strong/p; } } ? any assistance is greatly appreciated -- PHP General Mailing List
[PHP] Re: form not submitting when I change action from PHP_SELF to thanks page
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 ?php ? ??? 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: form action=thanks.php method=POST 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
[PHP] need to convert field names into array for form submission
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: pHome Phone Number:/p input maxlength=6 size=6 name=area_code id=area_code value={$_POST['area_code']} nbsp; input maxlength=6 size=6 name=phone_exchange id=phone_exchange value={$_POST['phone_exchange']} nbsp; input maxlength=10 size=10 name=last_4_digits id=last_4_digits value={$_POST['last_4_digits']} nbsp; 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 = div class='red'You haven't entered your . str_replace(_, , $fieldname) . !/divbr /; } elseif ( isset($err_msg)) { $err_msg .=div class='red'You haven't entered your . str_replace(_, , $fieldname) . !/divbr /; } } 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
Re: [PHP] what should I look for with this error
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] what should I look for with this error
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
I don't see any missing semi-colons off hand. The error is supposedly on line 556 in the below code: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html!-- InstanceBegin template=/Templates/subpage_template.dwt codeOutsideHTMLIsLocked=false -- head !-- InstanceBeginEditable name=doctitle -- titleWealth Development Mortgage :: TEAM/title !-- InstanceEndEditable -- meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 !-- InstanceBeginEditable name=head -- !-- InstanceEndEditable -- link href=WDM.css rel=stylesheet type=text/css /head body div id=main !-- InstanceBeginEditable name=header -- div id=header div id=logo img src=/test/images/logo.gif alt=Wealth Development Mortgage /div div id=sloganimg src=/test/images/slogan.gif alt=company slogan /div div id=top_navigation ul id=topnav lia href=HOME/a/li li class=border_lefta href=CONTACT US/a/li li class=border_lefta href=PAYMENT CALCULATOR/a/li /ul /div /div !-- InstanceEndEditable -- !-- end header and begin main content information -- !-- InstanceBeginEditable name=mainnav -- div id=mainnav ul id=navlist li class=border_righta href=../index.htm title=home linkHOME/a/li li class=border_righta href=# title=company information COMPANY/a/li li class=border_righta href=# title=about the teamTEAM/a/li li class=border_righta href=# title=contact usCONTACT/a/li lia href=# title=fill out our on-line applicationAPPLY ONLINE/a/li /ul /div !-- InstanceEndEditable -- !-- flash will go here, image used as placeholder for now -- div id=flash img src=/test/images/flash_image.jpg alt=for position only /div div id=page_title_bar !-- InstanceBeginEditable name=page_header --h1TEAM/h1!-- InstanceEndEditable -- /div !-- InstanceBeginEditable name=maincontent -- table class=Loan_Application title=Secure Loan Application cellspacing=0 summary=Full Loan Application for Wealth Development Mortgage Company caption Secure Loan Application /caption tr td class=headerWealth Development Mortgage Company provides fast mortgage approvals online.br Your Application will be placed in top priority and receive immediate attention./td /tr tr td ?php $form_block=END_FORM form method=POST action={$_SERVER['PHP_SELF']} class=loan_application fieldset fieldset legend title=Loan InformationLOAN INFORMATION/legend table tr td table tr td colspan=2label for=loan_purpose Loan Purpose:/label br select name=purpose id=purpose option value=Purchase selectedPurchase/option option value=refinance_no_cashRefinance - No Cash/option option value=refinance_cash_outRefinance - Cash Out/option option value=refinance_debt_consolidationRefinance - Debt Consolidation/option option value=refinance_change_loan_typeRefinance - Change Loan Type/option option value=construction_loanConstruction Loan/option option value=other_loan_purposeOther Loan Purpose/option /select/td tdlabel for=property_useProperty Use:/label br select class=textbox name=property id=property option value=Select One/option option value= selected--/option option value=primary_residencePrimary Residence/option option value=secondary_residenceSecondary Residence/option option value=investment_propertyInvestment Property/option /select /td /tr tr td colspan=2Loan Type: br select name=loan_type id=loan_type option value=30_year_fixed selected30 Year Fixed/option option value=15_year_fixed15 Year Fixed/option option value=10_arm10/1 ARM/option option value=7_arm7/1 ARM/option option value=5_arm5/1 ARM/option option value=3_arm3/1 ARM/option option value=1_arm1 year ARM/option option value=6m_arm6 month ARM/option
[PHP] re: blank page with PHP
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
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] need help finding parsing error please
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: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en-US lang=en-US dir=ltr head meta http-equiv=Content-type content=text/html; charset=ISO-8859-1 / titleInspired Evolution :: Contact/title meta http-equiv=pragma content=no-cache / meta name=revisit-after content=7 / meta name=keywords content=web design, communications, graphic design, North Carolina, Morrisville, Cary, Raleigh, Durham, creative, freelance, business, small business, creative services, web development, XHTML. CSS, accessibility, web standards, SEO, search engine optimization / meta name=description content=freelance web site design and development company specializing in creating unique, interesting, cross-browser friendly websites that conform to web standards, usability and accessibility and are SEO (search engine optimization) ready. / meta name=author content=Bruce Gilbert / meta name=robots content=ALL / meta name=classification content=web site development / meta name=copyright content=2005 - Inspired-Evolution / link rel=stylesheet href=Gilbert.css type=text/css media=screen, handheld / /head body !-- begin outer wrapper div -- div id=wrapper_outer a class=skiplink href=#startcontentSkip over navigation/a !-- begin header div -- div id=header ?php require('images/Rotating_Banner/rotating_banner.php'); ? /div !-- top nav list -- div id=navcontainer ul id=navlist li a href=About_Me.php title=you know you want to learn more about meAbout Me/a/li lia href=Skillset.php title=I've got skillzSkill set/a/li lia href=Hireme.php title=I can do wonders for your web presenceHire Me/a/li lia href=Portfolio.php title=web sites, graphics, newslettersPortfolio/a/li lia href=Contact.php title=how to get in touch with meContact/a/li lia href=Resume.php title=my beautiful resumeReacute;sumeacute;/a/li lia href=Blog.php title=My musings on everyday life Blog/a/li lia href=RSS.php title=Syndication that is really simple RSS/a/li /ul /div !-- inner content wrapper div -- div id=wrapper_inner !-- breadcrumbs div -- div id=breadcrumbsa href=index.php title=home link accesskey=1Home/a gt; gt; Contact/div !-- text div -- div id=main_content a name=startcontent id=startcontent/a h1 title=ContactContact/h1 ?php $form_block=END_FORM form method=POST action={$_SERVER['PHP_SELF']} class=info_request fieldset legend title=additional information requestAdditional Information Request/legend table tr td label for=firstnamespan class=red*/span First Name: /label/td td input id=firstname name=firstname type=text value={$_POST['firstname']} / /td /tr tr td label for=lastnamespan class=red*/span Last Name:/label/td td input id=lastname name=lastname type=text value={$_POST['lastname']} / /td /tr tr td label for=companyspan class=red*/span Company: /label/td td input id=company name=company type=text value={$_POST['company']} //td /tr tr td label for=phonespan class=red*/span Phone: /label/td td input id=phone name=phone type=text value={$_POST['phone']} //td /tr tr td label for=emailspan class=red*/span e-mail: /label/td td input id=email name=email type=text value={$_POST['email']} //td /tr tr td label for=email2span class=red*/span re-enter e-mail: /label/td td input id=email2 name=email2 type=text value={$_POST['email2']} / /td /tr tr td label for=URL URL:/label/td td input id=URL type=text name=URL / /td /tr tr td label for=Contact_Preference Best way to reach:/label/td td input id=Contact_Preference name=Contact_Preference type=text value={$_POST['Contact_Preference']} //td /tr tr td label for=Contact_Time Best time to contact:/label/td td input id=Contact_Time name=Contact_Time type=text value={$_POST['Contact_Time']} / /td /tr tr td input type=hidden name=op value=ds / /td /tr tr td textarea name=message rows=25 cols=50Send me a detailed message specifying what you wish to accomplish with your web site./textarea input class=submit src=/images/submit.gif alt=Submit type=image name=submit / /td /tr /table /fieldset /form pspan class=red*/span indicates a required field./p 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 = span class='red'Please re-enter your .$fieldname./span; } elseif ( isset
[PHP] cannot find the parse error
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 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en-US lang=en-US dir=ltr head meta http-equiv=Content-type content=text/html; charset=ISO-8859-1 / titleInspired Evolution :: Contact/title meta http-equiv=pragma content=no-cache / meta name=revisit-after content=7 / meta name=keywords content=web design, communications, graphic design, North Carolina, Morrisville, Cary, Raleigh, Durham, creative, freelance, business, small business, creative services, web development, XHTML. CSS, accessibility, web standards, SEO, search engine optimization / meta name=description content=freelance web site design and development company specializing in creating unique, interesting, cross-browser friendly websites that conform to web standards, usability and accessibility and are SEO (search engine optimization) ready. / meta name=author content=Bruce Gilbert / meta name=robots content=ALL / meta name=classification content=web site development / meta name=copyright content=2005 - Inspired-Evolution / link rel=stylesheet href=Gilbert.css type=text/css media=screen, handheld / /head body !-- begin outer wrapper div -- div id=wrapper_outer a class=skiplink href=#startcontentSkip over navigation/a !-- begin header div -- div id=header ?php require('images/Rotating_Banner/rotating_banner.php'); ? /div !-- top nav list -- div id=navcontainer ul id=navlist li a href=About_Me.php title=you know you want to learn more about meAbout Me/a/li lia href=Skillset.php title=I've got skillzSkill set/a/li lia href=Hireme.php title=I can do wonders for your web presenceHire Me/a/li lia href=Portfolio.php title=web sites, graphics, newslettersPortfolio/a/li lia href=Contact.php title=how to get in touch with meContact/a/li lia href=Resume.php title=my beautiful resumeReacute;sumeacute;/a/li lia href=Blog.php title=My musings on everyday life Blog/a/li lia href=RSS.php title=Syndication that is really simple RSS/a/li /ul /div !-- inner content wrapper div -- div id=wrapper_inner !-- breadcrumbs div -- div id=breadcrumbsa href=index.php title=home link accesskey=1Home/a gt; gt; Contact/div !-- text div -- div id=main_content a name=startcontent id=startcontent/a h1 title=ContactContact/h1 ?php $form_block=END_FORM form method=POST action=$_SERVER['PHP_SELF'] class=info_request fieldset legend title=additional information requestAdditional Information Request/legend table id=info_request tr td label for=firstnamespan class=red*/span First Name: /label/td td input id=firstname name=firstname type=text value={$_POST['firstname']} / /td /tr tr td label for=lastnamespan class=red*/span Last Name:/label/td td input id=lastname name=lastname type=text value={$_POST['lastname']} / /td /tr tr td label for=companyspan class=red*/span Company: /label/td td input id=company name=company type=text value={$_POST['company']} //td /tr tr td label for=phonespan class=red*/span Phone: /label/td td input id=phone name=phone type=text value={$_POST['phone']} //td /tr tr td label for=emailspan class=red*/span e-mail: /label/td td input id=email name=email type=text value={$_POST['email']} //td /tr tr td label for=email2span class=red*/span re-enter e-mail: /label/td td input id=email2 name=email2 type=text value={$_POST['email2']} / /td /tr tr td label for=URL URL:/label/td td input id=URL type=text name=URL / /td /tr tr td label for=Contact_Preference Best way to reach:/label/td td input id=Contact_Preference name=Contact_Preference type=text value={$_POST['Contact_Preference']} //td /tr tr td label for=Contact_Time Best time to contact:/label/td td input id=Contact_Time name=Contact_Time type=text value={$_POST['Contact_Time']} / /td /tr tr td input type=hidden name=op value=ds / /td /tr textarea name=Textarea rows=25 cols=50Send me a detailed message specifying what you wish to accomplish with your web site./textarea input class=submit src=/images/submit.gif alt=Submit type=image name=submit / /td /tr /table /fieldset /form 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 = 'span class=redPlease enter your first name!/span /br'; $send = no ; } // check value of $POST['email
[PHP] regarding form submission and option pull down menu
a few more questions about the submission process for a form with option choices. say I am using : form method=POST action=$_SERVER['PHP_SELF'] class=application select class=checkbox name=loan_process option value=Purchase selected=selectedPurchase/option option value=construct_homeConstruct Home/option option value=refinance_no_cashRefinance - No Cash/option option value=refinance_cash_outRefinance - Cash Out/option /select /form 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: ?php if(isset($_POST[loan_process])) echo $_POST[loan_process]; ? and without the isset? thanks! -- ::Bruce:: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] returning info. from a form selection
can anyone give me an idea on how to return info. from a forl pulldown menu eg: select class=textbox name=loan_process option value= selected=selectedPurchase/option option value=Construct Home/option option /select and return that to an email address. thanks -- ::Bruce:: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP error on form
Hello, I am trying to get a form to work integrating html with PHP. the code I have is: ? $form_block = FORM METHOD=\POST\ ACTION=\$PHP_SELF\ pstrongYour Name:/strong /br INPUT type=\text\ NAME=\senders_name\ SIZE=30/p pstrongpYour E-mail Address:/strong /br INPUT type=\text\ NAME=\senders_email\ SIZE=30/p pstrongMessage:/strong /br TEXTAREA NAME=\message\ COLS=30 ROWS=5 WRAP=virtual/TEXTAREA/p INPUT type=\hidden\ name=\op\ value=\ds\ pINPUT TYPE=\submit\ NAME=\submit\ VALUE=\Send this Form\/p /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 = font color=redPlease enter your name!/font /br; $send =no; } //check value of $_POST['sender_email'] if ($POST['sender_email'] ==) { $email_err =font color=redPlease enter your email address!/font /br; $send= no; } //check value of $_POST['message'] if ($POST['message'] ==) { $message_err = font color=redPlease enter a message!/font /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 pmail has been sent!/p; } 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
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: ? $form_block = FORM METHOD=\POST\ ACTION=\$PHP_SELF\ pstrongYour Name:/strong/p INPUT type=\text\ NAME=\senders_name\ SIZE=30/p pstrongYour E-mail Address:/strongp INPUT type=\text\ NAME=\senders_email\ SIZE=30/p pstrongMessage:/strong/p TEXTAREA NAME=\message\ COLS=30 ROWS=5 WRAP=virtual/TEXTAREA/p INPUT type=\hidden\ name=\op\ value=\ds\ pINPUT TYPE=\submit\ NAME=\submit\ VALUE=\Send this Form\/p /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 = font color=redPlease enter your name!/fontbr /; $send = no; } //check value of $_POST['sender_email'] if ($POST['sender_email'] ==) { $email_err =font color=redPlease enter your email address!/fontbr /; $send= no; } //check value of $_POST['message'] if ($POST['message'] ==) { $message_err = font color=redPlease enter a message!/fontbr /; $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 pmail has been sent!/p; } 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 = FORM METHOD=\POST\ ACTION=\$PHP_SELF\ pstrongYour Name:/strong /br INPUT type=\text\ NAME=\senders_name\ SIZE=30/p pstrongpYour E-mail Address:/strong /br INPUT type=\text\ NAME=\senders_email\ SIZE=30/p pstrongMessage:/strong /br TEXTAREA NAME=\message\ COLS=30 ROWS=5 WRAP=virtual/TEXTAREA/p INPUT type=\hidden\ name=\op\ value=\ds\ pINPUT TYPE=\submit\ NAME=\submit\ VALUE=\Send this Form\/p /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 = font color=redPlease enter your name!/font /br; $send =no; } //check value of $_POST['sender_email'] if ($POST['sender_email'] ==) { $email_err =font color=redPlease enter your email address!/font /br; $send= no; } //check value of $_POST['message'] if ($POST['message'] ==) { $message_err = font color=redPlease enter a message!/font /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 pmail has been sent!/p; } 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 I don't think your error message is indicative of this, but PHP /will/ choke on your lines that include array key references
[PHP] PHP form not working
Here is the entire code on the page. Now I am getting an error again... !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en-US lang=en-US dir=ltr head meta http-equiv=Content-type content=text/html; charset=ISO-8859-1 / titleForm Test/title ?php require('includes/meta_tags.inc'); ? link rel=stylesheet href=Gilbert.css type=text/css media=screen, handheld / /head body !-- begin outer wrapper div -- div id=wrapper_outer a class=skiplink href=#startcontentSkip over navigation/a !-- begin header div -- div id=header?php require('images/Rotating_Banner/rotating_banner.php'); ?/div !-- top nav list -- div id=navcontainer ul id=navlist li a href=About_Me.php title=you know you want to learn more about meAbout Me/a/li lia href=Skillset.php title=I've got skillzSkill set/a/li lia href=Hireme.php title=I can do wonders for your web presenceHire Me/a/li lia href=Portfolio.php title=web sites, graphics, newslettersPortfolio/a/li lia href=Contact.php title=how to get in touch with meContact/a/li lia href=Resume.php title=my beautiful resumeReacute;sumeacute;/a/li lia href=Blog.php title=My musings on everyday life Blog/a/li lia href=RSS.php title=Syndication that is really simple RSS/a/li /ul /div !-- inner content wrapper div -- div id=wrapper_inner !-- breadcrumbs div -- div id=breadcrumbsa href=index.php title=home link accesskey=1Home/a gt; gt; Contact/div !-- text div -- div id=main_content a name=startcontent id=startcontent/a h1 title=ContactContact/h1 ? $form_block = FORM METHOD=\POST\ ACTION=\$PHP_SELF\ pstrongYour Name:/strong/p INPUT type=\text\ NAME=\senders_name\ SIZE=30/p pstrongYour E-mail Address:/strongp INPUT type=\text\ NAME=\senders_email\ SIZE=30/p pstrongMessage:/strong/p TEXTAREA NAME=\message\ COLS=30 ROWS=5 WRAP=virtual/TEXTAREA/p INPUT type=\hidden\ name=\op\ value=\ds\ pINPUT TYPE=\submit\ NAME=\submit\ VALUE=\Send this Form\/p /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 = font color=redPlease enter your name!/fontbr /; $send = no; } //check value of $_POST['sender_email'] if ($POST['sender_email'] ==) { $email_err =span class=redPlease enter your email address!/spanbr /; $send= no; } //check value of $_POST['message'] if ($POST['message'] ==) { $message_err = span class=redPlease enter a message!/spanbr /; $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 pmail has been sent!/p; } else if ($send ==no) { //print error messages echo $name_err; echo $email_err; echo $message_err; echo $form_block; } } ? pspan class=red*/span indicates a required field./p p/p p/p ?php require('includes/bottom_links.inc'); ?/div !-- begin footer -- div id=footer ?php require('includes/footer.inc'); ? span class=date? $last_modified = filemtime(index.php); print(Last Modified ); print(date(m/j/y h:i, $last_modified)); ?/span /div p class=footertagInspired-Evolution - Web Site: Design, Development, Marketing for Raleigh/Durham, Chapel Hill, Cary North Carolina./p /div /div /body /html 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] quick question about using capital letters coding w/ PHP
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] 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: ?php $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'pstrongError!/strong Fields marked span class=red */span are required to continue./pbr /'; echo'pPlease go back to the a href=Contact.phptitle=Contact MeContact Me/a page and try it again!/p'; } if (!eregi(^[a-z0-9]+([_\\.-][a-z0-9]+)*.@.([a-z0-9]+([\.-][a-z0-9]+)*)+.\\.[a-z]{2,}.$,$email)) { echo 'pInvalid email address entered./pbr /'; echo 'pPlease go back to the a href=Contact.php title=Contact MeContact Me/a page and try it again!/p'; } if (($email) != ($email2)) { echo 'strongError!/strong e-mail addresses dont match.br /'; } $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 pHello, strong$firstname/strong.br /br / We have received your request for additional information, and will respond shortly.br / Thanks for visiting inspired-evolution.com and have a wonderful day!br /br / Regards,br /br / strongInspired Evolution/strong/p; ? 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
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: php-general@lists.php.net 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: ?php $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'pstrongError!/strong Fields marked span class=red */span are required to continue./pbr /'; echo'pPlease go back to the a href=Contact.phptitle=Contact MeContact Me/a page and try it again!/p'; } if (!eregi(^[a-z0-9]+([_\\.-][a-z0-9]+)*.@.([a-z0-9]+([\.-][a-z0-9]+)*)+.\\.[a-z]{2,}.$,$email)) { echo 'pInvalid email address entered./pbr /'; echo 'pPlease go back to the a href=Contact.php title=Contact MeContact Me/a page and try it again!/p'; } if (($email) != ($email2)) { echo 'strongError!/strong e-mail addresses dont match.br /'; } $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 pHello, strong$firstname/strong.br /br / We have received your request for additional information, and will respond shortly.br / Thanks for visiting inspired-evolution.com and have a wonderful day!br /br / Regards,br /br / strongInspired Evolution/strong/p; ? 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] Re: not sure why form submission gives me error
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] not sure why form submission gives me error
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 :-( ?php $name=$_POST[firstname]; $name=$_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 'pstrongError!/strong Fields marked * are required to continue./p/br';include 'include/contact.php'; return; } if (!eregi(^[a-z0-9]+([_\\.-][a-z0-9]+)* .@.([a-z0-9]+([\.-][a-z0-9]+)*)+.\\.[a-z]{2,}.$,$email)) { echo 'pInvalid email address entered/p/br'; 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 p Hello,strong $firstname/strong./p p We have received your request for additional information, and will respond shortly./p p Thanks for visiting inspired-evolution.com and have a wonderful day!/p; } ? -- ::Bruce:: -- 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
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 (bCannot connect to database, check if username, password and host are correct./b); $success = mysql_select_db ($database); if (!$success) { print bCannot 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] connecting to MySQL from a Mac
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 your username -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] trouble with file upload page using PHP
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: ?php if( $_FILES['file'] ['name'] != ) {copy ( $_FILES ['file'] ['tmp_name'], /hsphere/local/home/bruceg/inspired-evolution.com/.$_FILES['file']['name']) or die ( Could not copy file ); } else{ die ( No file specified ) ; } ? ul li Sent: ?php echo $_FILES ['file'] ['name']; ?/li liSize: ?php echo $_FILES ['file'] ['size']; ? bytes /li liType: ?php echo $_FILES ['file'] ['type']; ? /ul a href=?php echo $_FILES ['file'] ['name'] ; ? View File/a 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] PHP search
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