SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    need help with php

    i an fairly new at php and i have created this site. http://munnaz.com/the-devils-battalion/ i was wondering if you could tell me how to make my form work.. go to the site and click on contact us and fill it out and it just takes you back to the main page instead of what it should say.
    now go to http://munnaz.com/the-devils-battali...contact-us.php and fill it out and then it sould work properly! what is the problem!!
    please help munnaz

  2. #2
    SitePoint Evangelist TRISPECTIVE's Avatar
    Join Date
    Sep 2002
    Location
    n/a
    Posts
    477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First, you have a form issue. The first one is submitted to:

    <form action="/the-devils-battalion/index.php"
    and the second one to:

    <form action="/the-devils-battalion/include/contact-us.php"

  3. #3
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    if TRISPECTIVE'S notes dont make a difference, post your code in full for the form as well as the php coding.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here are the codes to both pages the bits in red are the bits that are involved but you can look through it all to see if there is an easier way!!

    ----------------------------------------------------------------------
    index.php
    ----------------------------------------------------------------------
    <!--Created & Designed by Eli Burford-->
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <link href="stylesheets.css" rel="stylesheet" type="text/css"/>
    <title>[ The Devils Battalion ]</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript">
    <!--
    function MM_displayStatusMsg(msgStr) { //v2.0
    status=msgStr;
    document.MM_returnValue = true;
    }
    //-->
    </script>
    </head>

    <body bgcolor="#222222" topmargin="0">
    <BODY onLoad="MM_displayStatusMsg('[ The Devils Battalion ] by munnaz.com');return document.MM_returnValue">

    <TABLE WIDTH=700 BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0>
    <TR>
    <TD COLSPAN=7> <IMG SRC="images/image_01.jpg" ALT=""></TD>
    <TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=2 ALT=""></TD>
    </TR>
    <TR>
    <TD ROWSPAN=9>
    <IMG SRC="images/image_02.jpg" ALT=""></TD>
    <TD COLSPAN=5> <a href="index.php">
    <IMG SRC="images/headings/randompic.php" WIDTH=616 HEIGHT=175 ALT="Home" border="0"></a></TD>
    <TD ROWSPAN=9>
    <IMG SRC="images/image_04.jpg" ALT=""></TD>
    <TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=175 ALT=""></TD>
    </TR>
    <TR>
    <TD COLSPAN=5>
    <IMG SRC="images/image_05.jpg" ALT=""></TD>
    <TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=17 ALT=""></TD>
    </TR>
    <TR>
    <TD ROWSPAN=7> <IMG SRC="images/image_06.jpg" ALT=""></TD>
    <TD background="images/image_07.jpg">
    <table width="148" height="220" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td align="center" valign="top">&nbsp;</td>
    </tr>
    <tr>
    <td align="center" valign="top"><a href="index.php?page=home">Home</a></td>
    </tr>
    <tr>
    <td align="center" valign="top"><a href="index.php?page=episodes">Episodes</a></td>
    </tr>
    <tr>
    <td align="center" valign="top"><a href="index.php?page=videos">Videos</a></td>
    </tr>
    <tr>
    <td align="center" valign="top"><a href="index.php?page=pictures">Pictures</a></td>
    </tr>
    <tr>
    <td align="center" valign="top"><a href="index.php?page=stories">Stories</a></td>
    </tr>
    <tr>
    <td align="center" valign="top"><a href="index.php?page=other-stuff">Other Stuff</a></td>
    </tr>
    <tr>
    <td align="center" valign="top"><a href="index.php?page=forum">Forum</a></td>
    </tr>
    <tr>
    <td align="center" valign="top"><a href="index.php?page=equipment">Equipment</a></td>
    </tr>
    <tr>
    <td align="center" valign="top"><a href="index.php?page=the-crew">The Crew</a></td>
    </tr>
    <tr>
    <td align="center" valign="top"><a href="index.php?page=contact-us">Contact Us</a></td>
    </tr>
    <tr>
    <td align="center" valign="top">&nbsp;</td>
    </tr>
    <tr>
    <td align="center" valign="top">&nbsp;</td>
    </tr>
    </table>
    </TD>
    <TD ROWSPAN=7> <IMG SRC="images/image_08.jpg" ALT=""></TD>
    <TD ROWSPAN=5> <table width="462" height="696" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td align="left" valign="top" background="images/image_09.jpg">
    <?php
    switch( $_GET['page'] )
    {
    default:
    include 'include/home.php';
    break;

    case 'home' :
    include 'include/home.php';
    break;

    case 'contact-us' :
    include 'include/contact-us.php';
    break;


    case 'episodes' :
    include 'include/episodes.php';
    break;

    case 'equipment' :
    include 'include/equipment.php';
    break;

    case 'forum' :
    include 'include/forum.php';
    break;

    case 'other-stuff' :
    include 'include/other-stuff.php';
    break;

    case 'pictures' :
    include 'include/pictures.php';
    break;

    case 'stories' :
    include 'include/stories.php';
    break;

    case 'the-crew' :
    include 'include/the-crew.php';
    break;

    case 'videos' :
    include 'include/videos.php';
    break;

    case 'stats_lastupdated' :
    include 'include/statistics/last-updated.php';
    break;
    }
    ?></td>
    </tr>
    </table></TD>
    <TD ROWSPAN=7> <IMG SRC="images/image_10.jpg" ALT=""></TD>
    <TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=220 ALT=""></TD>
    </TR>
    <TR>
    <TD> <IMG SRC="images/image_11.jpg" ALT=""></TD>
    <TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=18 ALT=""></TD>
    </TR>
    <TR>
    <TD> <table width="148" height="220" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td align="left" valign="top" background="images/image_12.jpg"><p align="center">Nothing Yet!</p></td>
    </tr>
    </table></TD>
    <TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=220 ALT=""></TD>
    </TR>
    <TR>
    <TD> <IMG SRC="images/image_13.jpg" ALT=""></TD>
    <TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=18 ALT=""></TD>
    </TR>
    <TR>
    <TD ROWSPAN=2> <table width="148" height="227" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td align="left" valign="top" background="images/image_14.jpg"><p align="center"><b>TDB Was Created/b><br>
    April 21 2005</p>
    <p align="center"><b><a href="index.php?page=stats_lastupdated">List Of When All Pages Were Last Updated</a></b><br>
    </p></td>
    </tr>
    </table></TD>
    <TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=220 ALT=""></TD>
    </TR>
    <TR>
    <TD ROWSPAN=2>
    <p>
    <IMG SRC="images/image_15.jpg" border="0"></p></TD>
    <TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=7 ALT=""></TD>
    </TR>
    <TR>
    <TD> <IMG SRC="images/image_16.jpg" ALT=""></TD>
    <TD> <IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=3 ALT=""></TD>
    </TR>
    </TABLE>
    </body>
    </html>

    <center><span style="width: 100%; font-family: helvetica; font-size: 6px;">
    &nbsp;</span></center>
    <p><br></p>

    ----------------------------------------------------------------------
    include/contact-us.php
    ----------------------------------------------------------------------
    <p align="center"><font size="4">Contact Us</font></p>
    <?php

    // Handle POST method.
    if ($_POST)
    {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $comments = $_POST['comments'];

    // Compose simple text message:
    $message = "From $name ($email)\n\nComments:\n\n$comments";

    // Send message to bob@microsoft.com
    mail("munnaz_2003@hotmail.com", "TDB Form: Contact Us", $message);

    // Thank the generous user
    echo "<center><hl>Thanks for contacting us, we will get back to you as soon as possible.</hl></center>\n";
    }
    else
    {

    ?>
    <p align="center">If something on this site is not working or you have something
    you wish to say or add about any section of this site or simply have a question
    all you have to do is fill out the form below or email me on the address below
    that and I'll get back to you as
    soon as possible.</p>
    <form action="<?= $PHP_SELF ?>" method="post">

    <p align="center">Name:&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="text" name="name" size="20" /><br>
    Email:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="text" name="email" size="20" /></p>

    <p align="center">Commentsbr>
    <textarea name="comments" rows="6" cols="50"></textarea></p>

    <p align="center"><input type="submit" value="Send!" /></p>

    </form>
    <p align="center">
    <font size="2">
    <a href="mailto:munnaz_2003@hotmail.com" style="text-decoration: none">
    munnaz_2003@hotmail.com</a> </font></p>

    <?php

    }

    ?>
    --------------------------------------------------------------------------


    Thanks Heaps
    Munnaz

  5. #5
    SitePoint Evangelist TRISPECTIVE's Avatar
    Join Date
    Sep 2002
    Location
    n/a
    Posts
    477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Change to:

    <form action="<?= $PHP_SELF ?>?page=contact-us" method="post">
    if you don't add the "?page=contact-us" thing, the switch query will default to home.php and not include the contact-us.php script you have there.

  6. #6
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  7. #7
    SitePoint Evangelist TRISPECTIVE's Avatar
    Join Date
    Sep 2002
    Location
    n/a
    Posts
    477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Glad it worked out


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
  •