zero-perfoliate
zero-perfoliate

Author Topic: Need help modifying feedback-script!  (Read 794 times)

Offline Anders_Scales

  • PHP Workers
  • **
  • Posts: 5
  • Karma: +0/-0
Need help modifying feedback-script!
« on: March 29, 2009, 07:10:06 AM »
I am trying to modify this feedback-script, to fit my homepage. The homepage is basicly one html-file, with lots of DIVs that can be shown and hidden by clicking the menu. The problem is, that the feedbackform is setup with $formurl, $errorurl and $thankyouurl, being other html-pages. So i need help do make it change the state of a given DIV instead. I think this is the part that needs to be changed, but im really not into php-coding, so im not sure.

if (($email_is_required && (empty($email) || !ereg("@", $email))) || ($name_is_required && empty($name)) || ($mailto_is_required && empty($mailto))) {
   header( "Location: $errorurl" );
   exit ;
}
if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
   header( "Location: $errorurl" );
   exit ;
}
if (empty($email)) {
   $email = $mailto ;


Here's the entire code.

Code: [Select]
<?php

// ------------- CONFIGURABLE SECTION ------------------------

// $mailto - set to the email address you want the form
// sent to, eg
//$mailto = "youremailaddress@example.com" ;

$mailto $_POST['reciever'] ;

// $subject - set to the Subject line of the email, eg
//$subject = "Feedback Form" ;

$subject "Scales Feedback Form" ;

// the pages to be displayed, eg
//$formurl = "http://www.example.com/feedback.html" ;
//$errorurl = "http://www.example.com/error.html" ;
//$thankyouurl = "http://www.example.com/thankyou.html" ;

$formurl "http://www.scalesmusic.dk/feedback.html" ;
$errorurl "http://www.scalesmusic.dk/error.html" ;
$thankyouurl "http://www.scalesmusic.dk/thanks.html" ;

$mailto_is_required 1;
$email_is_required 1;
$name_is_required 1;
$uself 0;
$use_envsender 0;
$use_webmaster_email_for_from 0;
$use_utf8 1;

// -------------------- END OF CONFIGURABLE SECTION ---------------

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" "\n" ;
$content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' 'Content-Type: text/plain; charset="utf-8"' ;
if (!isset( 
$use_envsender )) { $use_envsender ; }
$envsender "-f$email" ;
$name $_POST['name'] ;
$email $_POST['email'] ;
$comments $_POST['comments'] ;
$http_referrer getenv"HTTP_REFERER" );

if (!isset(
$_POST['email'])) {
header"Location: $formurl" );
exit ;
}
if ((
$email_is_required && (empty($email) || !ereg("@"$email))) || ($name_is_required && empty($name)) || ($mailto_is_required && empty($mailto))) {
header"Location: $errorurl" );
exit ;
}
if ( 
ereg"[\r\n]"$name ) || ereg"[\r\n]"$email ) ) {
header"Location: $errorurl" );
exit ;
}
if (empty(
$email)) {
$email $mailto ;
}
$fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email $mailto ;

if (
get_magic_quotes_gpc()) {
$comments stripslashes$comments );
}

$messageproper =
"This message was sent from:\n" .
"$http_referrer\n" .
"------------------------------------------------------------\n" .
"Name of sender: $name\n" .
"Email of sender: $email\n" .
"------------------------- COMMENTS -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;

$headers =
"From: \"$name\" <$fromemail>" $headersep "Reply-To: \"$name\" <$email>" $headersep "X-Mailer: chfeedback.php 2.13.0" .
$headersep 'MIME-Version: 1.0' $headersep $content_type ;

if (
$use_envsender) {
mail($mailto$subject$messageproper$headers$envsender );
}
else {
mail($mailto$subject$messageproper$headers );
}
header"Location: $thankyouurl" );
exit ;

?>


Offline PhPHelper

  • http://Digiscapers.com
  • Full Member
  • PHP Problem Solvers
  • ****
  • Posts: 179
  • Karma: +50/-0
    • Bad Apple Mail
Re: Need help modifying feedback-script!
« Reply #1 on: March 29, 2009, 07:22:19 AM »
what you can do instead of having it redirect to a page just show a div instead

for example change:

Code: [Select]
if (($email_is_required && (empty($email) || !ereg("@", $email))) || ($name_is_required && empty($name)) || ($mailto_is_required && empty($mailto))) {
header( "Location: $errorurl" );
exit ;
}


to this

Code: [Select]
if (($email_is_required && (empty($email) || !ereg("@", $email))) || ($name_is_required && empty($name)) || ($mailto_is_required && empty($mailto))) {
header( "Location: http://www.yourdmain.com#errorurl" );
exit ;
}


#errorurl refers to a div with an id called errorurl

Offline Anders_Scales

  • PHP Workers
  • **
  • Posts: 5
  • Karma: +0/-0
Re: Need help modifying feedback-script!
« Reply #2 on: March 30, 2009, 12:22:48 AM »
Okay... nice i'll try it out sometime soon.

Offline Anders_Scales

  • PHP Workers
  • **
  • Posts: 5
  • Karma: +0/-0
Re: Need help modifying feedback-script!
« Reply #3 on: April 05, 2009, 06:48:24 AM »
I doesn't work :-[

I tried it out now with negative result. It doesn't try to open a new html-file, but it hides all of the vissible DIVs. Is it possible to target a script?

Offline PhPHelper

  • http://Digiscapers.com
  • Full Member
  • PHP Problem Solvers
  • ****
  • Posts: 179
  • Karma: +50/-0
    • Bad Apple Mail
Re: Need help modifying feedback-script!
« Reply #4 on: April 06, 2009, 02:57:10 PM »
for what your doing it may be better to use an accordion using jquery.

Offline Anders_Scales

  • PHP Workers
  • **
  • Posts: 5
  • Karma: +0/-0
Re: Need help modifying feedback-script!
« Reply #5 on: April 09, 2009, 07:22:08 PM »
for what your doing it may be better to use an accordion using jquery.

Explain plaese ???

Offline PhPHelper

  • http://Digiscapers.com
  • Full Member
  • PHP Problem Solvers
  • ****
  • Posts: 179
  • Karma: +50/-0
    • Bad Apple Mail
Re: Need help modifying feedback-script!
« Reply #6 on: April 10, 2009, 05:11:34 AM »
with an accordion you make div appear and disappear when certain actions take place.

here's a tutorial of how to make one : http://roshanbh.com.np/2008/03/make-accordion-using-jquery.html
here's a demo : http://roshanbh.com.np/examples/accordion/

Offline Anders_Scales

  • PHP Workers
  • **
  • Posts: 5
  • Karma: +0/-0
Re: Need help modifying feedback-script!
« Reply #7 on: April 11, 2009, 04:17:04 AM »
I allready has something like that. The problem is, to make my form-feedback toggle such a script, when you click submit.
The way it works now, the feedback script selects from 3 options, when submit is clicked: The feedback-url, the thankyou-url, and the error-url... witch all consist of independent html-documents. I need it to toggle different DIVs on/off instead.
It might help you to see the site. It's located here:
Code: [Select]
www.scalesmusic.dk/beta
If you want to try out the feedback-form, please select Webmaster, in the dropdown-menu, so the mail will be sent to me.
Note: Iv'e maneged to make it search in the correct html-document, but it doesn't toggle the correct DIVs, but turns all the open ones off instead (reloading the html-document).

 

zero-perfoliate