i dont believe javascript can directly connect to a database.
If you are asking if you can pass the yourname variable to php and then use php's database connectivity to store the information, then yes, you can.
actually, there's no direct way to pass a javascript variable to php.
the closest thing is to change the location of the page with javascript to an address containing the variable in the query string, and then grabbing the value of the variable with $_REQUEST or $_GET
or changing the value of a hidden field and submiting a form using javascript.
sounds abit complicated. Any idea how i can change the location of the page with javascript to an address containing the variable in the query string ??
<script language="JavaScript">
<!--hide
var yourname= prompt('Please enter your name', ' ');
document.formname.passYourName.value=yourname;
document.formname.submit();
//-->
</SCRIPT>