Solved

Php page not expanding

Posted on 2006-11-29
2
167 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

770 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