Results 1 to 5 of 5

Thread: Trying to echo and submit a form

  1. #1
    Join Date
    Feb 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Trying to echo and submit a form

    Evening,

    I am trying to echo a form that is listed below, the form appears in my page, but when I press submit, nothing happens. Can anyone give me guidance on what step I am missing?

    PHP Code:
    //below this is the function for no record!!
    if (!$variable1)
    {
    echo 
    "<p> Great news! Jeff is available. Please fill out the form below to contact Jeff about booking your date. Please note, your date IS NOT booked yet, it simply is available. Make sure to fill out this form so Jeff can get back to you.</p>";

    echo(
    '<form action="http://formmail.dreamhost.com/cgi-bin/formmail.cgi" method="POST">');
    echo(
    '<input type="hidden" name="recipient" value="pray@wburgnaz.com"><br>');
    echo(
    '<input type="hidden" name="subject" value="Wedding Booking Inquiry"></p><br>');
          echo(
    ' <p>Full Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" size="20" name="name" ></p><br>');
          echo(
    ' <p>Phone Number: <input type="text" size="20"  name="phone"></p><br>');
          echo(
    ' <p>Email Address: <input type="text" size="20"  name="email"></p><br>');
          echo(
    ' <p>Wedding Date: <input type="text" size="20"  name="weddate"></p><br>');
          echo(
    '  <p><input name="Submit" type="button" value="Submit" class="button" /></p>');
          echo(
    '</form>');



    }
    //end
    ?> 

  2. #2
    Join Date
    Oct 2007
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Where is the <?php ?
    You also have to remember that you cannot use " without putting a \ in front of it. You also need to close off your echo statements with a ;
    Try the following code:
    Code:
    <?php
    //below this is the function for no record!!
    if (!$variable1)
    {
    echo "<p>Great news! Jeff is available. Please fill out the form below to contact Jeff about booking your date. Please note, your date IS NOT booked yet, it simply is available. Make sure to fill out this form so Jeff can get back to you.</p>";
    
    echo "<form action=\"http://formmail.dreamhost.com/cgi-bin/formmail.cgi\" method=\"POST\">";
    echo "<input type=\"hidden\" name=\"recipient\" value=\"pray@wburgnaz.com\"><br>";
    echo "<input type=\"hidden\" name=\"subject\" value=\"Wedding Booking Inquiry\"></p><br>";
    echo "<p>Full Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type=\"text\" size=\"20\" name=\"name\" ></p><br>";
    echo "<p>Phone Number: <input type=\"text\" size=\"20\"  name=\"phone\"></p><br>";
    echo "<p>Email Address: <input type=\"text\" size=\"20\"  name=\"email\"></p><br>";
    echo "<p>Wedding Date: <input type="text" size=\"20\"  name=\"weddate\"></p><br>";
    echo "<p><input name=\"Submit\" type=\"button\" value=\"Submit\" class=\"button\" /></p>";
    echo "</form>";
    }
    //end
    ?>
    An even better way to do it is to stay away from using html inside php example:
    Code:
    <?php
    //below this is the function for no record!!
    if (!$variable1)
    {
    ?>
    <p>Great news! Jeff is available. Please fill out the form below to contact Jeff about booking your date. Please note, your date IS NOT booked yet, it simply is available. Make sure to fill out this form so Jeff can get back to you.</p>
    
    <form action="http://formmail.dreamhost.com/cgi-bin/formmail.cgi" method="POST">
    <input type="hidden" name="recipient" value="pray@wburgnaz.com"><br>
    <input type="hidden" name="subject" value="Wedding Booking Inquiry"></p><br>
    <p>Full Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" size="20" name="name" ></p><br>
    <p>Phone Number: <input type="text" size="20"  name="phone"></p><br>
    <p>Email Address: <input type="text" size="20"  name="email"></p><br>
    <p>Wedding Date: <input type="text" size="20"  name="weddate"></p><br>
    <p><input name="Submit" type="button" value="Submit" class="button" /></p>
    </form>
    <?php
    }
    //end
    ?>

  3. #3
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    Go with the latter example given above...the backslashes just get too crazy when there's that much code. When there's small amounts of code, switch to single quotes around the code...doing so means no backslashes:

    PHP Code:
    echo '<p class="awesome">Awesome "Quotes!"</p>'
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

  4. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    @magik
    Your wrong, hes using single quotes, so it wouldn'y matter, he would need to put 'em before a ' not a ".
    Jeremy | jfein.net

  5. #5
    Join Date
    Feb 2008
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks so much for the help, I appreciate it, got it working!!

Bookmarks

Posting Permissions

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