help shim

6 posts Page 1 of 1
Contributors
User avatar
Shim
VIP - Donator
VIP - Donator
Posts: 882
Joined: Wed Dec 14, 2011 5:02 am

help shim
Shim
hello guys

i have a contact form created in html the markup is below
Code: Select all

    <p class="contact-form-sender"> <action="send.php"> <method="post">
    <input id="sender" type="text" placeholder="Name" name="sender" />
    </p>
    <p class="contact-form-email">
    <input id="email" type="text" placeholder="Email" name="email" />
    </p>
    <p class="contact-form-subject">
    <input id="subject" type="text" placeholder="Subject" name="subject" />
    </p>
    <p class="contact-form-content">
    <textarea id="contact-content" placeholder="Your enquiries" name="content"></textarea>
    </p>
    <p class="contact-form-checkbox">
    <input id="agreement" type="checkbox" value="true" />
    <label for="agreement">I have read and agree to the <a href="#">terms and conditions</a>.</label>
    </p>
    <span class="button-met dark"><input id="consubmit" type="submit" name="consubmit" value="Send" /></span>

how can i make it work ?
Find my programs on Softpedia
User avatar
Scottie1972
Codenstuff Elite
Codenstuff Elite
Posts: 953
Joined: Thu Jan 14, 2010 5:48 am

Re: help shim
Scottie1972
mshimranpro wrote:
hello guys

i have a contact form created in html the markup is below
Code: Select all

    <p class="contact-form-sender"> <action="send.php"> <method="post">
    <input id="sender" type="text" placeholder="Name" name="sender" />
    </p>
    <p class="contact-form-email">
    <input id="email" type="text" placeholder="Email" name="email" />
    </p>
    <p class="contact-form-subject">
    <input id="subject" type="text" placeholder="Subject" name="subject" />
    </p>
    <p class="contact-form-content">
    <textarea id="contact-content" placeholder="Your enquiries" name="content"></textarea>
    </p>
    <p class="contact-form-checkbox">
    <input id="agreement" type="checkbox" value="true" />
    <label for="agreement">I have read and agree to the <a href="#">terms and conditions</a>.</label>
    </p>
    <span class="button-met dark"><input id="consubmit" type="submit" name="consubmit" value="Send" /></span>

how can i make it work ?



Above is HTML for ASP pages.
for plan HTML page you have to format the FORM using the <form/> tag and correct inputs.
Code: Select all
	<p class="contact-form-sender">
	<form method="POST" action="send.php">
		<p class="contact-form-sender">
		<input id="sender" type="text" value="Name" name="sender" /></p>
		<p class="contact-form-email">
		<input id="email" type="text" value="Email" name="email" /></p>
		<p class="contact-form-subject">
		<input id="subject" type="text" value="Subject" name="subject" /></p>
		<p class="contact-form-content">
		<textarea id="contact-content" value="Your enquiries" name="content"></textarea></p>
		<p class="contact-form-checkbox">
		<input id="agreement" type="checkbox" value="true" />
		<font>I have read and agree to the terms and conditions</font></p>
		<span class="button-met dark"><input id="consubmit" type="submit" name="consubmit" value="Send" /></span>
	</form>
	</p>
Tizag.com is a great place to learn basic HTML....check it out.
Image
User avatar
benji_19994
VIP - Donator
VIP - Donator
Posts: 156
Joined: Mon Apr 16, 2012 3:13 pm

Re: help shim
benji_19994
Code: Select all
<?php
$to = 'Youremail@email.com';
//enter Your Email
$email = $_POST['from'];
$subject = $_POST['subject'];
$body = $_POST['body'];
$header = 'From: '.$email;

 if(isset($_POST['subject'])&&isset($_POST['body'])&&isset($_POST['from']))
 {
    if (!empty($subject)&&!empty($body)&&!empty($header))
    {
     Echo 'Message Sen\'t Your Should Here from us soon';
     mail($to,$subject, $body, $header);
    }
    else
    {
     echo 'Please Enter All Fields';
    }
  }

?>
<form action="index.php" method="POST">
Subject:<br>
<input type="text" name="subject"><br>
Message:<br>
<textarea rows="4" cols="30" name="body">
</textarea><br>
Your Email:<br>
<input type="text" name="from"><br>
<input type="submit" value="Send">
</form>
I have done this code in php i wasn't able to get the checkbox to work but i can keep trying if you want me to =D
Where Youremail@email.com is put the email to your contact us email or your email
User avatar
visualtech
VIP - Donator
VIP - Donator
Posts: 265
Joined: Sat Nov 19, 2011 2:19 pm

Re: help shim
visualtech
benji_19994 wrote:
Code: Select all
<?php
$to = 'Youremail@email.com';
//enter Your Email
$email = $_POST['from'];
$subject = $_POST['subject'];
$body = $_POST['body'];
$header = 'From: '.$email;

 if(isset($_POST['subject'])&&isset($_POST['body'])&&isset($_POST['from']))
 {
    if (!empty($subject)&&!empty($body)&&!empty($header))
    {
     Echo 'Message Sen\'t Your Should Here from us soon';
     mail($to,$subject, $body, $header);
    }
    else
    {
     echo 'Please Enter All Fields';
    }
  }

?>
<form action="index.php" method="POST">
Subject:<br>
<input type="text" name="subject"><br>
Message:<br>
<textarea rows="4" cols="30" name="body">
</textarea><br>
Your Email:<br>
<input type="text" name="from"><br>
<input type="submit" value="Send">
</form>
I have done this code in php i wasn't able to get the checkbox to work but i can keep trying if you want me to =D
Where Youremail@email.com is put the email to your contact us email or your email
change
Code: Select all

<form action="index.php" method="POST">

to
Code: Select all
<form action="<? $SERVER['PHP_SELF']; ?> method="POST">
if the form is embedded in a PHP Script!
Image
User avatar
benji_19994
VIP - Donator
VIP - Donator
Posts: 156
Joined: Mon Apr 16, 2012 3:13 pm

Re: help shim
benji_19994
visualtech wrote:
benji_19994 wrote:
Code: Select all
<?php
$to = 'Youremail@email.com';
//enter Your Email
$email = $_POST['from'];
$subject = $_POST['subject'];
$body = $_POST['body'];
$header = 'From: '.$email;

 if(isset($_POST['subject'])&&isset($_POST['body'])&&isset($_POST['from']))
 {
    if (!empty($subject)&&!empty($body)&&!empty($header))
    {
     Echo 'Message Sen\'t Your Should Here from us soon';
     mail($to,$subject, $body, $header);
    }
    else
    {
     echo 'Please Enter All Fields';
    }
  }

?>
<form action="index.php" method="POST">
Subject:<br>
<input type="text" name="subject"><br>
Message:<br>
<textarea rows="4" cols="30" name="body">
</textarea><br>
Your Email:<br>
<input type="text" name="from"><br>
<input type="submit" value="Send">
</form>
I have done this code in php i wasn't able to get the checkbox to work but i can keep trying if you want me to =D
Where Youremail@email.com is put the email to your contact us email or your email
change
Code: Select all

<form action="index.php" method="POST">

to
Code: Select all
<form action="<? $SERVER['PHP_SELF']; ?> method="POST">
if the form is embedded in a PHP Script!
It Would be
Code: Select all
<form action="<? $_SERVER['PHP_SELF']; ?> method="POST">
User avatar
Scottie1972
Codenstuff Elite
Codenstuff Elite
Posts: 953
Joined: Thu Jan 14, 2010 5:48 am

Re: help shim
Scottie1972
benji_19994 wrote:

It Would be
Code: Select all
<form action="<? $_SERVER['PHP_SELF']; ?> method="POST">
it should be
Code: Select all
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST">
for 1) the server may not have SHORT_TAGS enabled ei: "<?"
for 2) you forgot the closing ["] double quote in the action="" tag.

and also. if he is unable to make a simple HTML Form, do you think he could do it is a self submitting php script?
Image
6 posts Page 1 of 1
Return to “Help & Support”