[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

Problem with PHP-form-evaluation

Asked by spetrowitsch in PHP Scripting Language, PHP for Windows

Tags: php, form, evaluation

Hi,

I have a file index.php, which contains the following code:

<form name="newUser" action="order.php" amethod="post">
<input type="hidden" name="newUser" value="1">
  <table summary="registerForm" border=0>
  <tr><td><b>Anrede:</b></td><td>
  <table border="0" cellpadding="0" cellspacing="0"><tr><td>
  <select name="title" size="1">
    <option value="Mr." <?=$title['Mr.']?>Herr</option>
    <option value="Mrs." <?=$title['Mrs.']?>Frau</option>
    <option value="Miss" <?=$title['Miss']?>Frl.</option>
  </select></td></tr></table>
  <tr><td><b>Vorname:</b></td><td><input type="text" name="firstname" size="40" maxlength="50" <?=$val['firstname']?></td><td></td></tr>
  <tr><td><b>Nachname:&nbsp;&nbsp;&nbsp;</b></td><td><input type="text" name="surname" size="40" maxlength="50" <?=$val['surname']?></td><td></td></tr>
  <tr><td><b>E-Mail:</b></td><td><input type="text" name="email" size="40" maxlength="60" <?=$val['email']?></td>
  Bitte senden Sie mir per E-Mail (jeder Anhang wird in einer extra Mail versandt):<br>
  <tr><td valign="top"><br><input type="checkbox" name="info1" value="1" <?=$check['info1']?></td><td valign="top"><br>Information about the silver discount card(445 KB, PDF-Format)</td><td></td> </tr>
  <tr><td valign="top"><br><input type="checkbox" name="antrag" value="1" <?=$check['antrag']?></td><td valign="top"><br>Contract for the silver discount card (853 KB,
  PDF-Format)</td><td></td> </tr>
  <tr><td valign="top"><br><input type="checkbox" name="info2" value="1" <?=$check['info2']?></td><td valign="top"><br>Information about the silver- and gold-discount-card (1160 KB, PDF-Format)</td><td></td> </tr>
  <tr><td valign="top"><br><input type="checkbox" name="kuendigung" value="1" <?=$check['kuendigung']?></td><td valign="top"><br>A letter for cancelling the contract for the silver-discount-card. (41 KB, PDF-Format)</td><td></td></tr><br>
  <tr><td valign="top"><br></td><td valign="top"></td></tr>
  <tr><td valign="top"><br></td><td valign="top"><button type="submit" onClick="self.location.href='order.php'" name="submit">Anfrage Absenden</button></td></tr></table>

</form>


If hitting the Submit-button I go to order.php, which looks like the code below. But I always get the message "Invalid charactor" at line 29, character 1.
URL: file:///D:/.../order.php?newUser=1&title=Mr.&firstname=a&surname=b&email=info@fuerihrenerfolg

and if I choose to continue processing the script, the next page looks like this:
Any hint, what´s wrong?

0) { echo("Korrigieren / ergänzen Sie bitte das Feld '" . $smsg[0] . "'

"); $fehler = 1; } if (!strlen($HTTP_POST_VARS['surname']) > 0) { echo("Korrigieren / ergänzen Sie bitte das Feld '" . $smsg[1] . "'

"); $fehler = 1; } if (!strlen($HTTP_POST_VARS['email']) > 0) { echo("Korrigieren / ergänzen Sie bitte das Feld '" . $smsg[2] . "'

"); $fehler = 1; } elseif (!eregi('^[0-9a-z~!\#\$%&-]+(\.?[0-9a-z~!\#\$%&-])*\@[0-9a-z~!\#\$%&-]+(\.?[0-9a-z~!\#\$%&-])*$', $HTTP_POST_VARS['email'])) { echo("Korrigieren / ergänzen Sie bitte das Feld '" . $smsg[2] . "'

"); $fehler = 1; } # anything missing if ($fehler > 0) { echo("

Zurück zur Eingabeseite"); exit(); } else { echo("
Die gewünschten Unterlagen werden an Sie versandt:




My order.php:
============

<html><head><title>Günstiger Einkaufen - bis 50 % Rabatt auf fast alles</title></head>
<body>

<?php
session_start();
require 'newwin.php';

$fehler = 0;

$smsg = array("Vorname", "Nachname", "email", "eine g&uuml;tige E-Mail-Adresse");
# check data submitted for registration
if (!strlen($HTTP_POST_VARS['firstname']) > 0) {
   echo("Korrigieren / erg&auml;nzen Sie bitte das Feld '" . $smsg[0] . "'<br><br>");
   $fehler = 1;
}
if (!strlen($HTTP_POST_VARS['surname']) > 0) {
   echo("Korrigieren / erg&auml;nzen Sie bitte das Feld '" . $smsg[1] . "'<br><br>");
   $fehler = 1;
}
if (!strlen($HTTP_POST_VARS['email']) > 0) {
   echo("Korrigieren / erg&auml;nzen Sie bitte das Feld '" . $smsg[2] . "'<br><br>");
   $fehler = 1;
} elseif (!eregi('^[0-9a-z~!\#\$%&-]+(\.?[0-9a-z~!\#\$%&-])*\@[0-9a-z~!\#\$%&-]+(\.?[0-9a-z~!\#\$%&-])*$', $HTTP_POST_VARS['email'])) {
   echo("Korrigieren / erg&auml;nzen Sie bitte das Feld '" . $smsg[2] . "'<br><br>");
   $fehler = 1;
}
# anything missing
if ($fehler > 0) {
   echo("</ul><br><button type=\"submit\" onClick=\"self.location.href='index.php'\">Zurück zur Eingabeseite</button></body></html>");
   exit();
} else {

   echo("<br><font color=\"red\">Die gewünschten Unterlagen werden an Sie versandt:<br></font><br><br>");
   if ($HTTP_POST_VARS['antrag'] > 0) {
     $mail_1 = new htmlMimeMail();
     $mail_1->setCrlf("\n");
     $mail_1->setText("Lieber $firstname $surname,\n\nhier die Antragsunterlagen für die im ersten Jahr kostenfreie Silber-Rabattkarte. Bitte füllen Sie diese vollständig aus (bis auf das graue Feld, dies ist freiwillig), und senden es mir zurück.<br><br>Ihr<br><br>Stephan Petrowitsch<br>Mühlmahd 16<br>86482 Aystetten");
     $mail_1->addAttachment($mail_1->getFile("http://www.einkaufen.fuerihrenerfolg.de/VC_3_Teilnahmeantrag_SundM_Package.pdf"), "VC_3_Teilnahmeantrag_SundM_Package.pdf", 'application/pdf');
     $mail_1->setFrom('Stephan Petrowitsch <info@fuerihrenerfolg.de>');
     $mail_1->setSubject("Antragsunterlagen Rabatt-Karte");
     $result = $mail_1->send(array($_SESSION['loggedIn']));
     if (!$result) {
        echo("<br><b>Abschicken der E-Mail fehlgeschlagen. Bitte kontaktieren Sie mich per E-Mail: Stephan.Petrowitsch@gmx.de</b><br><br>");
     } else {
        echo("<br><b>E-Mail mit den Antragsunterlagen versandt.</b><br>");
     }
   }
[+][-]02/08/08 10:38 AM, ID: 20852752Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/08/08 01:01 PM, ID: 20854102Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: PHP Scripting Language, PHP for Windows
Tags: php, form, evaluation
Sign Up Now!
Solution Provided By: shirazti
Participating Experts: 2
Solution Grade: A
 
[+][-]02/08/08 06:11 PM, ID: 20855935Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/08/08 11:29 PM, ID: 20856533Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 / EE_QW_2_20070628