Solved

Php page not expanding

Posted on 2006-11-29
2
165 Views
Last Modified: 2006-12-02
Hi,

If you go to this address:

http://www.toubes-page.net/td/yhteystiedot/index.php?id=content&page=tarjouspyynto

and try to send the the form leaving all fields empty you get to a page which says what column you left empty.

Ok, the form and the error check works fine.. but the thing that doesn't work is the page expanding when an error message is displayed, if all fields are filled correctly the success expands the page as it should.

here's the code for the page:

<span class="linkit" style="margin-left: 38px; font-size: 11px; font-weight: bold;"><a href="../yhteystiedot">Yhteystiedot</a> / <a href="index.php?id=content&page=tarjouspyynto">Tarjouspyyntö</a> / Kiitos</span>
</div>
<div id="inner_bg"><br/>
<div style="margin-left: 40px; margin-right: 20px;">

<?php

  if (empty($name))
     {
            echo "<span style=\"font-weight: bold;\">Nimikenttä on tyhjä, palaa takaisin</span><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br class=\"clear\" /><br/>";
             exit;
     }

 if (empty($email))
     {
          echo "<span style=\"font-weight: bold;\">Sähköpostikenttä on tyhjä, palaa takaisin</span><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>"; ---> when a field is left empty this message is displayed and the page is not expnded as it should be.


              exit;
     }

$good = ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.
               '@'.
               '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
               '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',
               $email);
     if (!$good)
     {
          echo "<span style=\"font-weight: bold;\">Sähköpostikentässä virheellisiä kirjaimia, palaa takaisin</span><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>";
          exit;
     }


 if (empty($nro))
     {
          print "<p style=\"font-weight: bold;\">Puhelinnumerokenttä on tyhjä, palaa takaisin</p><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>";

          exit;
     }

$name=$_POST['name'];
$email=$_POST['email'];
$nro=$_POST['nro'];
$internetsivut=$_POST['Internetsivut'];
$pc=$_POST['pc'];
$it=$_POST['IT'];
$message=$_POST['message'];
$to="tobias.fransman@taloverkot.fi";
$message="$name jätti tarjouspyynnön.\n \nE-mail: $email\n \nPuhnro: $nro\n\nKiinnostusalueet:\n$internetsivut\n$pc\n$it\n \n
Viesti: $message";

if(mail($to,"Toubes Design Tarjouspyyntö",$message,"From: $email\n"))
{
      echo "Kiitos Tarjouspyynnöstänne, otamme teihin mahdollisimman pian yhteyttä"; ---> when success this text is displayed and the page is fully expanded
}

else
{
      echo "Syntyi virhe lähetyksessä, yritä uudelleen.";
}
?>

<br class="clear" />
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>

Any clues why the expanding is not working on the  if (empty($name)) elements but works on the success element?

Thanks,

-Toby
0
Comment
Question by:Toube
2 Comments
 
LVL 1

Accepted Solution

by:
bobbyo earned 300 total points
ID: 18044466
Hi,

I seem to be getting the same result if I leave all fields blank or if I complete them?
0
 

Author Comment

by:Toube
ID: 18044842
Hi, if you complete them you should get a message saying 'Kiitos Tarjouspyynnöstänne, otamme teihin mahdollisimman pian yhteyttä' and then the page looks just like it should look like.. background streched and so on.

-Toby
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Wordpress Query 1 32
php variable basic question 12 27
PHP string issue 5 17
Converting SQL server date to string 3 15
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now