Link to home
Start Free TrialLog in
Avatar of richmo587
richmo587

asked on

Form is not sending me the info i need

Ok, i have no idea what i am doing and i have searched the internet far and wide. I am trying to get emailed the form fields that are filled in with the php below. Here is what i get back in an email.

Name: Judith Richmond

              Company: Plymouth Educational Center\'s Foundation

                    WWW:

                    First Wesite:
But nothing for the WWW and First Site, the weird thing is my input value is not companyname it is company and that is working. Please help i have been at this since 8am est. the link to the form is http://www.jktconsultants.com/PECF_design.html.
<?php
  $email = $_REQUEST['email'] ;
  $fullname = $_REQUEST['fullname']; 
  $text = $_REQUEST['text'];
  $message = "Name: $fullname\n
              Company: $companyname\n
WWW: $text\n 
 First Wesite: $webLike1\n" ;
 
  mail( "richmo58@jktconsultants.com", "Feedback Form Results",
    $message, "From: $email"); 
  header( "Location: http://www.jktconsultants.com/thanks.html" );
?>

Open in new window

Avatar of Roger Baklund
Roger Baklund
Flag of Norway image

The action attribute of the form points to a script "cgi-bin/mail.php", is that the script you posted in the snippet? Because of the mismatched field names I would guess you are editing the wrong script...
Avatar of richmo587
richmo587

ASKER

Yes that is the script i am refeerring too. So if I understand you I changes the php script see below: Is that what you mean by "mismatched field names"? When I changed it I am now getting a 500 error
<?php
  $email = $_REQUEST['email'] ;
  $name = $_REQUEST['name']; 
  $message = "Name: $name\n
              Company Name: $company\n
			  First Site: $weblike\n" ;
 
  mail( "richmo58@jktconsultants.com", "Feedback Form Results",
    $message, "From: $email"); 
  header( "Location: http://jktconsultants.com/cgi-bin/thanks.html" );
?>
 

Open in new window

Do these files have to be in a cgi-bin folder?
No, php files does not normally have to be in a cgi-bin folder.

The mismatched field names was $company/$companyname and $name/$fullname. In the form, the fields are named 'company' and 'name', in the snippet you posted you read field with names 'companyname' and 'fullname', and it worked. It should not have worked. That is why I was guessing it was the wrong script.

I can't see anything that would result in a 500 Internal server error. Using the wrong field name will not give such an error, it will just give blank values.

Do you have access to the web server error logs?

Try this, it will show which variables are available:
<?php
 
  var_dump($_REQUEST);
 
  $email = $_REQUEST['email'] ;
  $name = $_REQUEST['name']; 
  $message = "Name: $name\n
              Company Name: $company\n
                          First Site: $weblike\n" ;
 
  mail( "richmo58@jktconsultants.com", "Feedback Form Results",
    $message, "From: $email"); 
  #header( "Location: http://jktconsultants.com/cgi-bin/thanks.html" );
?>

Open in new window

Yeah that really didnt work, i changed it back because there is a thanks.html in the root folder. However there is also one in the cgi-bin folder but when i code in that path it doesnt like it? I
That brought up the results in a browser and sent me an email. The weblike part is not filled in the email below:

Name: JK Thornburg And Associates

              Company Name: Plymouth Educational Center\'s Foundation

                          First Site:

array(41) { ["name"]=> string(27) "JK Thornburg And Associates" ["company"]=> string(41) "Plymouth Educational Center\'s Foundation" ["email"]=> string(22) "richmo58@studiojkt.com" ["webLike"]=> string(23) "www.thatwasfuckedup.com" ["likeweb4"]=> string(0) "" ["webLike2"]=> string(4) "www." ["webLike3"]=> string(4) "www." ["dweb4"]=> string(4) "www." ["dlikeweb4"]=> string(0) "" ["fonts2"]=> string(0) "" ["fonts3"]=> string(0) "" ["otherexpand2"]=> string(0) "" ["graphics3"]=> string(0) "" ["graphics"]=> string(0) "" ["email2"]=> string(0) "" ["copyrinfo"]=> string(0) "" ["graphics4"]=> string(0) "" ["graphics5"]=> string(0) "" ["aother1t"]=> string(0) "" ["aother2t"]=> string(0) "" ["aother3t"]=> string(0) "" ["aother4t"]=> string(0) "" ["startpages"]=> string(0) "" ["graphics7"]=> string(0) "" ["info"]=> string(0) "" ["sell"]=> string(0) "" ["product"]=> string(0) "" ["impress"]=> string(0) "" ["prospects"]=> string(0) "" ["contact"]=> string(0) "" ["brand"]=> string(0) "" ["otherdetails"]=> string(0) "" ["otherdetails2"]=> string(0) "" ["otherexpand"]=> string(0) "" ["otherservicestext"]=> string(0) "" ["keyword"]=> string(0) "" ["otherkeyword"]=> string(0) "" ["graphics6"]=> string(0) "" ["sixweeks"]=> string(104) "A Website completion date of 6 weeks from the date I provide all needed graphics and copy is acceptable." ["compdate"]=> string(22) "Time required in weeks" ["Submit"]=> string(6) "Submit" } 

Open in new window

Those mismatched fills came from someone else that was helping me earlier today with this. I dont know why it was working but it was and when i put the corret values in it would not return the form input -
The name of the "First site" variable is 'webLike', not 'weblike' (capital L). Variable names are case sensitive.

You can remove the line with var_dump(), that was only to see which variables you are sending.

For better formatting of the message in the email, use one of these methods:
$message = "Name: $name\n".
           "Company Name: $company\n".
           "First Site: $webLike\n";
 
# Alternatively:
$message = "Name: $name
Company Name: $company
First Site: $webLike";

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Roger Baklund
Roger Baklund
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just got up cxr: let me take a look at this and i will respond - Thanks