Jump to content

form not showing


fantomel

Recommended Posts

ok so i`m building a small website..and i've written some php code for it but it seems that on contact form i have some errors and still the editors don't show anything maybe you guys can help me around

home page where the include heapens



<?php
if($url == 'home')
{
	echo '<img src="../resources/img/content/home_girl.png" style="float:right;margin: 5px; margin-right: 20px; margin-top: 20px;" width="300px" height="208">';
}
if($url == 'quality')
{
	echo'<img src="../resources/img/content/labpic_03.png" style="float:right; margin:5px" width="200px" height="270">';
}
echo $content_page;
if($url == 'gallery')
{
	include_once('gallery.php');
} 
elseif($url == 'howto')
{
	include_once('howto.php');
}
elseif($url == 'home')
{
	include_once('eco.php');
}
elseif($url == 'contact' && $lang == 'en')
{
	include_once('contact.php');
}
elseif($url == 'contact' && $lang == 'ro')
{
	include_once('contactro.php');
}
?>

 

 

<?php
function afisare_formular($stare=1)
    {
    /* daca valoarea variabilei $stare este 1 atunci se afiseaza formularul normal
    si se seteaza valorile din formular la 0 */
    if ($stare == 1)
        {
        $nume = '';
        $email = '';
        $telefon = '';
        $mesaj = '';
        }
    /* daca valoarea variabilei $stare este diferita de 1 atunci se preiau mai intai
    datele trimise anterior prin POST din formular si se afiseaza formularul
    din nou dar cu valorile primite. */
    else
        {
        $nume = $_POST['nume'];
        $email = $_POST['email'];
        $telefon = $_POST['telefon'];
        $mesaj = $_POST['mesaj'];
        }
    // se genereaza variabila cu tabelul care contine formularul
    $formular = '
<div class="contact_form">
		<fieldset>
		<form name="contact" id="contact" method="post" action=' . $_SERVER['PHP_SELF'] . '>
			<label for"Nume">Name:</label><br />
			<input name="nume" type="text" id="nume" value="'.$nume.'" maxlength="50"><br />
			<label for="Email">E-mail:</label><br />
			<input name="email" type="text" id="email" value="'.$email.'" maxlength="50"><br />
			<label for="Phone">Phone:</label><br />
			<input name="telefon" type="text" id="telefon" value="'.$telefon.'" maxlength="15"><br />
			<label for="Message">Message:</label><br />
			<textarea name="mesaj" cols="35" rows="3" wrap="virtual" id="mesaj">'.$mesaj.'</textarea><br />
			<input type="submit" name="Submit" value="Trimite"><br />
		</form>
		'. $nume . $email . $telefon . $mesaj .'
		<div class="success" style="display:none;">Client has been added.</div>
		<div class="contact_details" style="float: left; margin-top: -220px;  margin-left: 210px;"><b>British Director: Stephen Smyth <br />
									 Mobile Phone: 0720 613 513<br />
									 Romanian Director: Marius Voicea <br />
									 Mobile Phone: 0723 560 719 <br />
									 Address: Str. 30 Decembrie Nr. 1 Urlati, Jud. Prahova
									 Phone: 0372 746 773</b>
									</div>
		</fieldset>
						<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/ms?ie=UTF8&hl=en&t=h&msa=0&msid=117426025458241534188.0004746603cb3fbf4da2a&ll=44.996292,26.228807&spn=0.002655,0.00456&z=17&output=embed"></iframe><br /><small>View <a href="http://maps.google.com/maps/ms?ie=UTF8&hl=en&t=h&msa=0&msid=117426025458241534188.0004746603cb3fbf4da2a&ll=44.996292,26.228807&spn=0.002655,0.00456&z=17&source=embed" style="color:#0000FF;text-align:left">Urlati Ecopoly</a> in a larger map</small>
		</div>';
    // se returneaza codul html pentru formularul care trebuie afisat
    return $formular;
    }

/* daca a fost incarcata prima data aceasta pagina de catre vizitator se
afiseaza formularul normal */
if (!isset($_POST['nume']))
    {
    echo afisare_formular(1);
    }
/* daca a fost deja apasat butonul te trimitere din formular se preiau datele
trimise si se verifica daca sunt corecte */
else
    {
    // se preiau datele trimise
    $nume = $_POST['nume'];
    $email = $_POST['email'];
    $telefon = $_POST['telefon'];
    $mesaj = $_POST['mesaj'];
    // se verifica daca sunt corecte
    $verificare = 0;
    if (empty($nume))
        {
        $verificare = 1;
        echo '<br>Nu a fost specificat Numele si prenumele.';
        }
    if (strlen($nume) < 3)
        {
        $verificare = 1;
        echo '<br>Numele trebuie sa contina minim 3 caractere.';
        }
    elseif (!eregi('[a-zA-Z ]{3}', $nume))
        {
        $verificare = 1;
        echo '<br>Numele trebuie sa contina minim 3 caractere.';
        }        
    if (empty($email))
        {
        $verificare = 1;
        echo '<br>Nu a fost introdusa adresa de e-mail';
        }
    if (!eregi("^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]{2,4}", $email))
        {
        $verificare = 1;
        echo '<br>Adresa de e-mail este incorecta.';
        }
    if (empty($telefon))
        {
        $verificare = 1;
        echo '<br>Nu a fost specificat un numar de telefon. Scrieti (-) daca nu aveti telefon.';
        }
    if (empty($mesaj))
        {
        $verificare = 1;
        echo '<br>Nu a fost specificat mesajul pe care doriti sa il trimiteti.';
        }
    /* daca in urma verificarilor de mai sus a aparut o eroare atunci
    variabila de verificare ar trebui sa aiba valoarea 1
    si in acest caz se afiseaza din nou formularul cu campurile deja completate
    pentru corectare */
    if ($verificare == 1)
        {
        echo afisare_formular(0);
        }
    /* daca in urma verificarilor de mai sus totul este ok
    se trimite mesajul pe e-mail */
    else
        {
        // se stabilesc variabilele care se vor trimite prin mail
        $subiect = 'Mesaj de la '.$_SERVER['SERVER_NAME'];
        // aici scrieti adresa de e-mail unde doriti sa primiti mesajele
        $adresa = 'digitals.future@yahoo.com';
        $continut = '<br>Nume si prenume: '.$nume.'
            <br>Adresa de e-mail: '.$email.'
            <br>Telefon: '.$telefon.'
            <br>Mesaj:<br><br>'.$mesaj.'
            <br>Mesajul a fost trimis la data de '.date('d-m-Y H:i', time());
        $headere = "From: $nume <$email>\r\n".
            "Reply-To: $email\r\n".
            "MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-2\r\n";
		"X-Mailer: PHP/" . phpversion();;
           // aici se incearca trimiterea mesajului pe mail
        if (@mail($adresa, $subiect, $continut, $headere))
            {
            echo '<META HTTP-EQUIV = "Refresh" Content = "1; URL =http://www.digitalupdates.co.cc">
                Mesajul a fost trimis cu succes. Asteptati pentru redirectare.';
            }
        else
            {
            echo '<META HTTP-EQUIV = "Refresh" Content = "1; URL =http://www.digitalupdates.co.cc">
                A aparut o eroare la serverul de mail, va rugam sa incercati din nou.<br>
                Asteptati pentru redirectare.';
            }

        }
    }
?>

 

error:

Parse error: syntax error, unexpected T_STRING in /home/ceoupdat/public_html/templates/contact.php on line 1

can someone help me please?

Link to comment
Share on other sites

error:

Parse error: syntax error, unexpected T_STRING in /home/ceoupdat/public_html/templates/contact.php on line 1

 

Means that there is some kind of Text String that there shouldn't be, in the file stated , at the position stated!

 

It's not clear from your post that there is anything wrong beyond what the php server is already reporting.

Link to comment
Share on other sites

I had a weird problem with a weird character that got into my text, back when I used regular windows notepad.  it corrupted my code.  If all else fails, you might look into that.

yeah was thinking on that had the same problem few days ago writing code and when i saved i accidentally changed the type for saving the file and the server didn't run the code... but i don't know what to say on localhost on xampp works perfect the same code..i`ll give a shot as you said and i will come back with news.. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.