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 3 of 3

Thread: Urgent Help

  1. #1
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Urgent Help

    HI all i am in my final year of university and i am trying to create a wap site using wml, php and mysql, at the moment i am tryin new things and i would like to know if anyone can supply me with code to create a wml form to use on an nokia emulator so that it allows user to add their first name and last name frm the emulator to the mysql databse.

    i have come up with this but it doesnt wrk.
    main screen

    reg.wml is

    <?xml version="1.0"?>
    <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
    "http://www.wapforum.org/DTD/wml_1.1.xml">
    <wml>
    <card ordered="false">

    <p>
    <fieldset title="Name" >
    First Name:
    <input name="firstname" maxlength="15" emptyok="false" /> <br/>
    Last Name:
    <input name="lastname" maxlength="15" emptyok="false" /> <br/>
    </fieldset>
    <anchor>
    Login
    <go href="newuser.php" method="post">
    <postfield name="firstname" value="$firstname"/>
    <postfield name="lastname" value="$lastname"/>

    </go>
    </anchor>
    <do type="accept"
    label="Login"
    name="Login">

    <go href="newuser.php" method="post">
    <postfield name="firstname" value="$firstname"/>
    <postfield name="lastname" value="$lastname"/>

    </go>
    </do>

    </p>
    </card>
    </wml>


    and newuser.php is

    <?php

    session_start();



    $firstname = $HTTP_POST_VARS['firstname'];
    $lastname = $HTTP_POST_VARS['lastname'];


    if (!$firstname || !$lastname ) {

    echo "You have not entered all your details correctly, please check all details are correct " ;
    exit;
    }

    //connect to the database
    @ $db = mysql_pconnect('localhost','eg185', 'm1d44');

    //message if connect failed
    if (!$db) {
    do_html_header('Registration Error');

    echo 'Error: Could not connect to database. Please try again later.';
    echo '</td></tr></table>';
    exit;
    }

    //use the right database
    mysql_select_db('eg185');

    //check if the username exists
    $query = "select firstname from pet where firstname = '".$firstname."'";
    $result = mysql_query($query);
    $num_results = mysql_num_rows($result);

    if ($num_results > 0) {
    echo 'The username you have entered is already taken, please re-enter another.';
    exit;
    }

    //register the customer
    $query = "insert into pet values ('".$firstname."' ,'".$lastname."')";
    $result = mysql_query($query);
    //$num_results = mysql_num_rows($result);


    if ($result) {
    echo "User Profile Created, ";
    echo ' Welcome ' ;
    echo ' ".$username." ' ;
    echo 'noc' ;
    }
    //$num_results = mysql_num_rows($result);


    ?>


    but when i try to connect it it says MIME type on newuser.php not supported.
    can any one help or suggest better code,

    kind regards

    kalpesh

    add me to msn kalps_p@hotmail.com to discuss
    thanks

  • #2
    New Coder
    Join Date
    Apr 2004
    Location
    Texas
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try making newuser.php echo wml instead of echoing straight text.
    Jason B

  • #3
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Ok first of all you need to read our rules and posting guidelines. Do not crosspost your questions and use an appropriate subject for your threads.

    http://www.codingforums.com/postguide.htm
    http://www.codingforums.com/rules.htm

    They are not that hard to follow if you would have taken the time to actually read them.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

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