...

View Full Version : Urgent Help



KALPS WAP MAN
04-21-2004, 03:26 PM
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

black3842
04-21-2004, 10:18 PM
try making newuser.php echo wml instead of echoing straight text.

Spookster
04-21-2004, 10:42 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum