Link to home
Start Free TrialLog in
Avatar of Toube
Toube

asked on

Php page not expanding

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
ASKER CERTIFIED SOLUTION
Avatar of bobbyo
bobbyo

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
Avatar of Toube
Toube

ASKER

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