Jump to content


Photo

Problem with a jump menu


  • Please log in to reply
19 replies to this topic

#1 danbluenun

danbluenun
  • Members
  • PipPip
  • Member
  • 11 posts
  • LocationYorkshire UK

Posted 28 September 2006 - 12:20 PM

Hi.

I am currently attemting to update a website that someone else has created.

On it, there is a form where the user can leave his/her details.

This data is emailed to my client and the user is sent to a "Thank You" page.

Part of the update is to add a drop-down menu onto the form where the user can tell my client how they heard about his company.

This is where I'm stuck. For some reason, the information is not being sent along with the rest of the data from the form. The resulting email reads as follows:

Company name : whatever compant
Company location : whatever location
Contact name : whatever name

email : customer@domain.net
Telephone no. : 071709859382310

Enquiry : blah, blah, blah
Found us by :





The code for the form is as follows (with the jump-menu at the bottom in red):

<form action="<?= $_SERVER['PHP_SELF'] ?>" method="POST">
                    <span class="sitetext">
                    <?php
if (count($errors) > 0)
echo '<span class="errortext">Please correct the errors in the form and try again.</span><BR><BR>';
?>
                    </span>
                    <table border="0" cellspacing="4" cellpadding="0">
                      <tr>
                        <td align="right" valign="middle" class="sitetextbold">Company name :</td>
                        <td align="left" valign="middle" class="sitetext">
                          <input name="company_name" type="text" id="company_name" size="30" value="<?= htmlentities($values['company_name']) ?>">
                        </td>
                        <td align="left" valign="top" class="sitetext">
                          <?= $errors['company_name'] ?>
                        </td>
                      </tr>
                      <tr>
                        <td align="right" valign="middle" class="sitetextbold">Company location :</td>
                        <td align="left" valign="middle" class="sitetext">
                          <input name="company_location" type="text" id="company_location" size="30" value="<?= htmlentities($values['company_location']) ?>">
                        </td>
                        <td align="left" valign="top" class="sitetext">
                          <?= $errors['company_location'] ?>
                        </td>
                      </tr>
                      <tr>
                        <td align="right" valign="middle" class="sitetextbold">Contact name :</td>
                        <td align="left" valign="middle" class="sitetext">
                          <input name="contact_name" type="text" id="contact_name" size="30" value="<?= htmlentities($values['contact_name']) ?>">
                        </td>
                        <td align="left" valign="top" class="sitetext">
                          <?= $errors['contact_name'] ?>
                        </td>
                      </tr>
                      <tr>
                        <td align="right" valign="middle" class="sitetextbold"> email address :</td>
                        <td align="left" valign="middle" class="sitetext">
                          <input name="email" type="text" id="email" size="30" value="<?= htmlentities($values['email']) ?>">
                        </td>
                        <td align="left" valign="top" class="sitetext">
                          <?= $errors['email'] ?>
                        </td>
                      </tr>
                      <tr>
                        <td align="right" valign="middle" class="sitetextbold">Telephone number :</td>
                        <td align="left" valign="middle" class="sitetext">
                          <input name="phone_no" type="text" id="phone_no" size="30" value="<?= htmlentities($values['phone_no']) ?>">
                        </td>
                        <td align="left" valign="top" class="sitetext">
                          <?= $errors['phone_no'] ?>
                        </td>
                      </tr>
                      <tr>
                        <td align="right" valign="top" class="sitetextbold">Your enquiry :</td>
                        <td align="left" valign="top" class="sitetext">
                          <textarea name="enquiry" cols="28" rows="8" id="enquiry"><?= htmlentities($values['enquiry']) ?></textarea>
                        </td>
                        <td align="left" valign="top" class="sitetext">
                          <?= $errors['enquiry'] ?>
                        </td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                        <td class="sitetext">
                          <p>&nbsp;
  <select name="select" onChange="MM_jumpMenu('parent',this,0)" >
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Recommendation</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Search
                                              Engine</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Flyer</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Total
                                              Mobile</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">What
                                              Mobile</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Computer
                                              Weekly</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Other</option>
                                            </select>
 
  </p>
                                <p>
                                  <input class="sitetext"type="submit" name="Submit" value="Submit">
                                </p></td>
                        <td>&nbsp;</td>
                      </tr>
                    </table>
                  </form>



The data is then sent to my clients email using the following code:

<?php
}

function ProcessForm($values)
{

$msg = "Company name : " . $values['company_name'] ."\n";
$msg .= "Company location : " . $values['company_location'] ."\n";
$msg .= "Contact name : " . $values['contact_name'] ."\n\n";
$msg .= "email : " . $values['email'] ."\n";
$msg .= "Telephone no. : " . $values['phone_no'] ."\n\n";
$msg .= "Enquiry : " . $values['enquiry'] ."\n";
$msg .= "Found us by : " . $values['found_us_by'] ."\n";

mail('dan@dearne.net', 'XS Form Submission', stripslashes($msg), "From: \"{$values['contact_name']}\" <{$values['email']}>");

header( "Location: thank_you.htm" );
}





Thanks is advance  ???

#2 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 28 September 2006 - 12:31 PM

Does it by any chance work if you select Recommendation but not the rest?

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#3 danbluenun

danbluenun
  • Members
  • PipPip
  • Member
  • 11 posts
  • LocationYorkshire UK

Posted 28 September 2006 - 12:38 PM

Afraid not.

Oops! I've just spotted what you noticed and ammended it. Still no luck.

I still get nothing after "Found us by:"


Thanks,

Dan

#4 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 28 September 2006 - 12:41 PM

ok, I think I'm missing something here....

Why are you using a jump menu for that option list?  I'm a little out of touch with HTML, but aren't jump menus, designed to move to another section of page/another page all together when you select the value?

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#5 danbluenun

danbluenun
  • Members
  • PipPip
  • Member
  • 11 posts
  • LocationYorkshire UK

Posted 28 September 2006 - 12:48 PM

Yes it is. Clearly, that's not what I need.

I've now changed it to:

<select name="select" >
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Recommendation</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Search
                                              Engine</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Flyer</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Total
                                              Mobile</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">What
                                              Mobile</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Computer
                                              Weekly</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Other</option>
                                            </select>



Still not getting anyhting after "Found us by" though.

Cheers. 

#6 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 28 September 2006 - 12:52 PM

I know what it is!...

Look at the name of your select box.  It's called 'select' not 'found_us_by'

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#7 danbluenun

danbluenun
  • Members
  • PipPip
  • Member
  • 11 posts
  • LocationYorkshire UK

Posted 28 September 2006 - 01:01 PM

Right, Huggie. I've just changed it to:

<select name="found_us_by" >
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Recommendation</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Search
                                              Engine</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Flyer</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Total
                                              Mobile</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">What
                                              Mobile</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Computer
                                              Weekly</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Other</option>
                                            </select>
 

Still no luck with it.

thanks,

Dan

#8 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 28 September 2006 - 01:08 PM

You need to change the php code too, but because I can't see all of that, I can't tell you what to change.

Are you able to post the php code that deals with the values once it's submitted?

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#9 danbluenun

danbluenun
  • Members
  • PipPip
  • Member
  • 11 posts
  • LocationYorkshire UK

Posted 28 September 2006 - 01:11 PM

Do you mean this?:

<?php
}

function ProcessForm($values)
{

$msg = "Company name : " . $values['company_name'] ."\n";     
$msg .= "Company location : " . $values['company_location'] ."\n";
$msg .= "Contact name : " . $values['contact_name'] ."\n\n";           
$msg .= "email : " . $values['email'] ."\n";         
$msg .= "Telephone no. : " . $values['phone_no'] ."\n\n";               
$msg .= "Enquiry : " . $values['enquiry'] ."\n";     
$msg .= "Found us by : " . $values['found_us_by'] ."\n";

mail('dan@domain.net', 'XS Form Submission', stripslashes($msg), "From: \"{$values['contact_name']}\" <{$values['email']}>");

header( "Location: thank_you.htm" );
}


Cheers,

Dan

#10 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 28 September 2006 - 01:13 PM

Yes, but there should be more than that..

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#11 danbluenun

danbluenun
  • Members
  • PipPip
  • Member
  • 11 posts
  • LocationYorkshire UK

Posted 28 September 2006 - 01:20 PM

There's also the following that goes below that, but i'm not sure if it's relevant:


if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$formValues = $_POST;
$formErrors = array();

if (!VerifyForm($formValues, $formErrors))
DisplayForm($formValues, $formErrors);
else
ProcessForm($formValues);
}
else
DisplayForm(null, null);



Plus, at the top of the page - as the form is posted to self:

<?php

function outputOptionList(&$list, $selected)
{
foreach ($list as $item)
echo "<option value=\"{$item['Value']}\"" . ($item['Value'] === $selected ? " selected=\"selected\"" : '') . ">{$item['Text']}</option>\n";
}

function VerifyForm(&$values, &$errors)
{
//form validation
if (strlen($values['company_name']) == 0)
$errors['company_name'] = '<img src="images/exclamation.gif" width="24" height="22">';

if (strlen($values['company_location']) == 0)
$errors['company_location'] = '<img src="images/exclamation.gif" width="24" height="22">';

if (strlen($values['contact_name']) == 0)
$errors['contact_name'] = '<img src="images/exclamation.gif" width="24" height="22">';

if (!ereg('.+@.+\..+', $values['email']))
$errors['email'] = '<img src="images/exclamation.gif" width="24" height="22">';

if (!is_numeric($values['phone_no']))
$errors['phone_no'] = '<img src="images/exclamation.gif" width="24" height="22">';

if (strlen($values['phone_no']) == 0)
$errors['phone_no'] = '<img src="images/exclamation.gif" width="24" height="22">';

if (strlen($values['enquiry']) == 0)
$errors['enquiry'] = '<img src="images/exclamation.gif" width="24" height="22">';

return (count($errors) == 0);
}

function DisplayForm($values, $errors)
{

?>




All of the other data in the form is emailed fine. It's just the "Found us by" bit that's blank.

Cheers,

Dan

#12 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 28 September 2006 - 01:32 PM

ok, do this for me...

After this code:

if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$formValues = $_POST;
$formErrors = array();

Put this:

var_dump($formValues);

This will output the contents of your formValues array to the screen.  Can you copy it and paste it here?

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#13 danbluenun

danbluenun
  • Members
  • PipPip
  • Member
  • 11 posts
  • LocationYorkshire UK

Posted 28 September 2006 - 01:40 PM

It outputs:

array(8) { ["company_name"]=> string(10) "My Company" ["company_location"]=> string(2) "UK" ["contact_name"]=> string(3) "Dan" ["email"]=> string(14) "dan@domain.net" ["phone_no"]=> string(11) "12709898310" ["enquiry"]=> string(10) "blah, blah" ["found_us_by"]=> string(0) "" ["Submit"]=> string(6) "Submit" }

Cheers,

Dan

#14 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 28 September 2006 - 01:50 PM

The fact it shows... ["found_us_by"]=> string(0) "" means it's submitting fine, but there's no value.

If you open the page in your browser and before you type anything in, view the source of the page.  Lets have a look at what the html looks like.

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#15 danbluenun

danbluenun
  • Members
  • PipPip
  • Member
  • 11 posts
  • LocationYorkshire UK

Posted 28 September 2006 - 01:56 PM

Code for the select menu:

   <SELECT name=found_us_by> <OPTION
                                value="" selected>Recommendation</OPTION>
                                <OPTION value="">Search Engine</OPTION> <OPTION
                                value="">Flyer</OPTION> <OPTION value="">Total
                                Mobile</OPTION> <OPTION value="">What
                                Mobile</OPTION> <OPTION value="">Computer
                                Weekly</OPTION> <OPTION
                              value="">Other</OPTION></SELECT> </P>



As you correctly say, there's no value.

I really feel that I've messed up with inserting the php into the value. There's knowhere that says the actual value that is to be passed.


Cheers,

Dan

#16 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 28 September 2006 - 02:00 PM

Where you've messed up is here:

function outputOptionList(&$list, $selected)
{
   foreach ($list as $item)
      echo "<option value=\"{$item['Value']}\"" . ($item['Value'] === $selected ? " selected=\"selected\"" : '') . ">{$item['Text']}</option>\n";
}

There's nothing that calls this.  It looks to me as though you've taken a page and tried to modify it, rather than coding it from the beginning, this isn't a major problem, but has meant that it's taken us a long while to find something simple...

Can I suggest you post the code of the whole page.

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#17 danbluenun

danbluenun
  • Members
  • PipPip
  • Member
  • 11 posts
  • LocationYorkshire UK

Posted 28 September 2006 - 02:07 PM

Yes, Huggie, I'm attempting to alter a website that has been created by someone else.

The code for the whole page is:

<?php

function outputOptionList(&$list, $selected)
{
foreach ($list as $item)
echo "<option value=\"{$item['Value']}\"" . ($item['Value'] === $selected ? " selected=\"selected\"" : '') . ">{$item['Text']}</option>\n";
}

function VerifyForm(&$values, &$errors)
{
//form validation
if (strlen($values['company_name']) == 0)
$errors['company_name'] = '<img src="images/exclamation.gif" width="24" height="22">';

if (strlen($values['company_location']) == 0)
$errors['company_location'] = '<img src="images/exclamation.gif" width="24" height="22">';

if (strlen($values['contact_name']) == 0)
$errors['contact_name'] = '<img src="images/exclamation.gif" width="24" height="22">';

if (!ereg('.+@.+\..+', $values['email']))
$errors['email'] = '<img src="images/exclamation.gif" width="24" height="22">';

if (!is_numeric($values['phone_no']))
$errors['phone_no'] = '<img src="images/exclamation.gif" width="24" height="22">';

if (strlen($values['phone_no']) == 0)
$errors['phone_no'] = '<img src="images/exclamation.gif" width="24" height="22">';

if (strlen($values['enquiry']) == 0)
$errors['enquiry'] = '<img src="images/exclamation.gif" width="24" height="22">';

return (count($errors) == 0);
}

function DisplayForm($values, $errors)
{

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR...ml4/loose.dtd">
<html>
<head>
<title>Contact Us</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META NAME="Keywords" CONTENT="XS mobile phones, Excess mobile phones, sell your phones, sell your mobiles, sell mobiles, sell mobile, money for your handset,sell phone,sell phones for cash,old mobile phones,turning mobiles into cash, mobile,mobile phones,old phones,money for old mobiles, Redundant mobile phones, unwanted phones, unwanted mobiles,sell mobile phones, Mobile phone recycling,Mobile trading,Mobile phone trading,cash for phones,cash for old mobiles,Old mobiles,sell mobiles online,Trade mobiles,Old mobile phones, mobile phone buyer, phone buyer, ">

<META NAME="Description" CONTENT="Turn old mobiles into cash. Sell your unwanted mobile phones online. Recycle unwanted mobile phones and raise funds for your company or chosen charity.">
<style type="text/css">
<!--
body {
background-color: #B6D6FF;
}
-->
</style>
<link href="xs.css" rel="stylesheet" type="text/css">
</head>

<body>
<br>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px solid #0053A4;">
  <tr>
    <td bgcolor="#FFFFFF"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center"><div align="left"><img src="images/xs_logo.gif" width="131" height="72"><a href="index.html"><img src="images/header_home_off.gif" width="77" height="72" border="0"></a><a href="about_xs_mobile_phones.htm"><img src="images/header_about_off.gif" width="96" height="72" border="0"></a><a href="xs_mobile_phones_corporate_service.htm"><img src="images/header_corporate_off.gif" width="158" height="72" border="0"></a><img src="images/header_contact_on.gif" width="109" height="72"><a href="xs_mobile_phones_faq.htm"><img src="images/header_faq_off.gif" width="187" height="72" border="0"></a></div></td>
      </tr>
      <tr>
        <td><table width="100%"  border="0" align="center" cellpadding="0" cellspacing="20">
          <tr>
            <td><span class="sitetext">We operate primarily as an Internet based business and therefore email enquiries using the contact form below have a much faster response time.
              </p>
            </span>
              <p><span class="sitetext">Please complete the form and leave as much information as possible. We aim to respond to all enquiries as a matter of urgency.
</span>             
              <table width="100%"  border="0" cellspacing="0" cellpadding="20">
                <tr>
                  <td width="55%" align="left" valign="top"><form action="<?= $_SERVER['PHP_SELF'] ?>" method="POST">
                    <span class="sitetext">
                    <?php
if (count($errors) > 0)
echo '<span class="errortext">Please correct the errors in the form and try again.</span><BR><BR>';
?>
                    </span>
                    <table border="0" cellspacing="4" cellpadding="0">
                      <tr>
                        <td align="right" valign="middle" class="sitetextbold">Company name :</td>
                        <td align="left" valign="middle" class="sitetext">
                          <input name="company_name" type="text" id="company_name" size="30" value="<?= htmlentities($values['company_name']) ?>">
                        </td>
                        <td align="left" valign="top" class="sitetext">
                          <?= $errors['company_name'] ?>
                        </td>
                      </tr>
                      <tr>
                        <td align="right" valign="middle" class="sitetextbold">Company location :</td>
                        <td align="left" valign="middle" class="sitetext">
                          <input name="company_location" type="text" id="company_location" size="30" value="<?= htmlentities($values['company_location']) ?>">
                        </td>
                        <td align="left" valign="top" class="sitetext">
                          <?= $errors['company_location'] ?>
                        </td>
                      </tr>
                      <tr>
                        <td align="right" valign="middle" class="sitetextbold">Contact name :</td>
                        <td align="left" valign="middle" class="sitetext">
                          <input name="contact_name" type="text" id="contact_name" size="30" value="<?= htmlentities($values['contact_name']) ?>">
                        </td>
                        <td align="left" valign="top" class="sitetext">
                          <?= $errors['contact_name'] ?>
                        </td>
                      </tr>
                      <tr>
                        <td align="right" valign="middle" class="sitetextbold"> email address :</td>
                        <td align="left" valign="middle" class="sitetext">
                          <input name="email" type="text" id="email" size="30" value="<?= htmlentities($values['email']) ?>">
                        </td>
                        <td align="left" valign="top" class="sitetext">
                          <?= $errors['email'] ?>
                        </td>
                      </tr>
                      <tr>
                        <td align="right" valign="middle" class="sitetextbold">Telephone number :</td>
                        <td align="left" valign="middle" class="sitetext">
                          <input name="phone_no" type="text" id="phone_no" size="30" value="<?= htmlentities($values['phone_no']) ?>">
                        </td>
                        <td align="left" valign="top" class="sitetext">
                          <?= $errors['phone_no'] ?>
                        </td>
                      </tr>
                      <tr>
                        <td align="right" valign="top" class="sitetextbold">Your enquiry :</td>
                        <td align="left" valign="top" class="sitetext">
                          <textarea name="enquiry" cols="28" rows="8" id="enquiry"><?= htmlentities($values['enquiry']) ?></textarea>
                        </td>
                        <td align="left" valign="top" class="sitetext">
                          <?= $errors['enquiry'] ?>
                        </td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                        <td class="sitetext">
                          <p>&nbsp;
  <select name="found_us_by" >
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Recommendation</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Search
                                              Engine</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Flyer</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Total
                                              Mobile</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">What
                                              Mobile</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Computer
                                              Weekly</option>
                                              <option value="<?= htmlentities($values['found_us_by']) ?>">Other</option>
                                            </select>
 
  </p>
                                <p>
                                  <input class="sitetext"type="submit" name="Submit" value="Submit">
                                </p></td>
                        <td>&nbsp;</td>
                      </tr>
                    </table>
                  </form></td>
                  <td align="left" valign="top" class="sitetext"></td>
                </tr>
              </table>              </td>
          </tr>
        </table>          </td>
      </tr>

    </table></td>
  </tr>
</table>
<div align="center" class="sitetextsmall"></span>XS Mobile Phones &copy; 2006</div><br>
</body>
</html>

<?php
}

function ProcessForm($values)
{

$msg = "Company name : " . $values['company_name'] ."\n";
$msg .= "Company location : " . $values['company_location'] ."\n";
$msg .= "Contact name : " . $values['contact_name'] ."\n\n";
$msg .= "email : " . $values['email'] ."\n";
$msg .= "Telephone no. : " . $values['phone_no'] ."\n\n";
$msg .= "Enquiry : " . $values['enquiry'] ."\n";
$msg .= "Found us by : " . $values['found_us_by'] ."\n";

mail('dan@domain.net', 'XS Form Submission', stripslashes($msg), "From: \"{$values['contact_name']}\" <{$values['email']}>");

header( "Location: thank_you.htm" );
}

if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$formValues = $_POST;
$formErrors = array();
var_dump($formValues);


if (!VerifyForm($formValues, $formErrors))
DisplayForm($formValues, $formErrors);
else
ProcessForm($formValues);
}
else
DisplayForm(null, null);
?>



Thanks, and sorry for being such a dummy,

Dan

#18 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 28 September 2006 - 02:17 PM

OK, you're hard coding the option descriptions, so you may as well just hard code the values...

<select name="found_us_by" >
<option value="Recommendation">Recommendation</option>
<option value="Search Engine">Search Engine</option>
<option value="Flyer">Flyer</option>
<option value="Total Mobile">Total Mobile</option>
<option value="What Mobile">What Mobile</option>
<option value="Computer Weekly">Computer Weekly</option>
<option value="Other">Other</option>
</select>

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#19 danbluenun

danbluenun
  • Members
  • PipPip
  • Member
  • 11 posts
  • LocationYorkshire UK

Posted 28 September 2006 - 02:23 PM

Of course, it works.


Basically, i tried to insert it using (what i thought were) the same methods as the guy that built the site. A little bit alien for somebody of my standard.

I can't believe that the solution was to do it more simply.


Sorry, and thanks loads.

I wish I had your patience!


Dan

#20 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 28 September 2006 - 02:30 PM

No problem at all.

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users