Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP space between lines

    How do you add horizontal space between lines using php code?

    I don't like how the elements are all stuck one right on top of the other and have no experience with php.

    I also would like to push the two first input boxes over and align them if that is an easy fix.

    Code:
    <?php
     		function spamcheck($field)
    			{
       			//filter_var() sanitizes the e-mail
      			//address using FILTER_SANITIZE_EMAIL
       			$field=filter_var($field, FILTER_SANITIZE_EMAIL);
     
      			//filter_var() validates the e-mail
       			//address using FILTER_VALIDATE_EMAIL
       			if(filter_var($field, FILTER_VALIDATE_EMAIL))
         			{
         			return TRUE;
         			}
       				else
         			{
         			return FALSE;
         			}
       			}
     
    			if (isset($_REQUEST['email']))
       			{//if "email" is filled out, proceed
     
      			//check if the email address is invalid
       				$mailcheck = spamcheck($_REQUEST['email']);
       				if ($mailcheck==FALSE)
         		{
         			echo "Invalid input";
         		}
       			else
         		{//send email
         			$email = $_REQUEST['email'] ;
         			$subject = $_REQUEST['subject'] ;
         			$message = $_REQUEST['message'] ;
         			mail("info@tbvet.com", "Subject: $subject",
         			$message, "From: $email" );
         			echo "Thank you for your message! If your message requires a response, we will get back to you as soon as possible.";
         		}
       			}
     			else
       			{//if "email" is not filled out, display the form
       				echo "<form method='post' action='mailform.php'>
       				Your email address: <input name='email' type='text' /><br />
       				Subject: <input name='subject' type='text' /><br />
       				Message:<br />
       				<textarea name='message' rows='15' cols='40'></textarea><br />
       				<input type='submit' name='submit' value='Submit' />
    				<input type='reset' name='reset' value='Reset' />
       				</form>";
       			}
     			?>

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    I think you're talking about the actual form?

    <form method='post' action='mailform.php'>
    Your email address: <input name='email' type='text' /><br />
    Subject: <input name='subject' type='text' /><br />
    Message:<br />
    <textarea name='message' rows='15' cols='40'></textarea><br />
    <input type='submit' name='submit' value='Submit' />
    <input type='reset' name='reset' value='Reset' />
    </form>


    This is not a PHP issue, but an HTML/CSS issue.

    One thing you can do is find an existing form online (anyone's website) that you like.
    Let us know. The HTML/CSS formatting of the "nice" form can be used on your site.


    .

  • #3
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mlseim View Post
    I think you're talking about the actual form?

    Your email address: <input name='email' type='text' /><br />
    Subject: <input name='subject' type='text' /><br />

    .
    I'm still confused by this...can you tell me how it knows how wide the field should be for these?

    I didn't think this was html because it was using sing quotes.

    I found this code on w3schools website and liked the idea that it could prevent spamming since you had to enter an actual email address.

    It works nicely, I just wanted to tweak it a little.

    As you can tell, I'm new to web design but have come a long way with completely re-desinging our company website.

    Thanks.

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    It's a PHP script, but the PHP is outputting the HTML to your browser.
    PHP is a server-side programming language (or scripting language), that is
    processed on the webhost's server. The script can send things to the browser,
    such as the HTML for displaying a web page, or files for downloading, etc.

    Using single quotes in HTML is the same as double quotes ...

    <img src="myphoto" alt="description" />
    <img src='myphoto' alt='description' />


    So, you are going to edit the HTML part of which the PHP script is sending to the user.

    Infinite number of ways to style that HTML for any number of user forms.

    Here is one of a gazillion ways to display your form ...
    http://www.catpin.com/contact.php

    In my example, I'm using CSS for styling the form.

    On any website, you can click the "view" link at the top of your browser,
    mouse down to "source" or "html source" and click. It will open the HTML
    used to display the web page.

    If you find a form somewhere on the internet that you love, view the HTML
    and see how it was done. The CSS (cascade style sheet) is a separate file
    that is referenced in the HTML page.

    In my example, the stylesheet is:
    http://www.catpin.com/style.css

    So you can see that we can't really answer your question, because each one of us
    would be answering it differently, depending on how we think it should look.

    Does that make sense?


    .

  • #5
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, I see now. I think it was because of all of the other "unfamilar" type code and the single quotes that got me majorly confused. Thank you for your help. I have no problem using css styling and will work on the form.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •