SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to open a new url when i click on the image

    hi

    When i click on the Sign in image then it should open this particular page called Spry_styles.page
    which i am calling the page in the Header Function here it goes like this header("Location:spry_styles.php?uname=".$cusername);

    but here the page is not being opend don't know why ...
    please tell what wrong iam i doing

    here is my code

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <?php
    function connect()
    {
    $dbhost='localhost';
    $dbuser='root';
    $dbpass='swetha';
    $conn= mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'.mysql_error());
    $dbname='hakman';
    mysql_select_db($dbname);
    return $conn;
    }
    function IsEmpty($cuser,$cpass)
    {
    $str1=strlen($cuser);
    $str2=strlen($cpass);
    $nRes=min($str1,$str2);
    echo "$nres";
    if ($nRes==0)
    {
    echo "<font size='4' face='Garamond' color='red'><b> Missing user Id / Password! </b></font> </br>";
    }
    return $nRes;
    }
    ?>

    <body bgcolor="#0a1936">
    <form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" name="form1" id="form1">
    <label><input type="image" name="signin" id="signin" src="/hdr_signin1.PNG" /></label>
    <br /><br />
    <label><input type="image" name="access" id="access" src="/access_acc2.PNG" /></label>
    <br /><br />
    <label style="color:#FFFFFF">Email Id: </label>&nbsp;&nbsp;
    <input type="text" name="cname" id='cname' height="14px" width="177px"/><br />
    <br />
    <label style="color:#FFFFFF">Password/label>&nbsp;
    <input type="text" name="cpass" id='cpass' height="14px" width="177px"/>
    <p>
    <input name="checkme" type="image" id="checkme" src="/sign_in_off1.PNG" />
    <?php
    if (!empty($_POST))
    {
    $cusername=$_POST['cname'];
    $cpassword=$_POST['cpass'];
    $check=IsEmpty($cusername,$cpassword);
    if ($check>0)
    {
    $cloginuser=$cusername;
    $c=connect();
    $query = "SELECT user_id,password FROM users where user_id='".$cusername."' AND password='".$cpassword."'";
    $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
    if (mysql_num_rows($result) > 0)
    {
    //echo"<font size='4' face='Garamond' color='white'><b>hello swetha</b></font></br>";

    header("Location:spry_styles.php?uname=".$cusername);

    }
    else
    {
    echo "<font size='4' face='Garamond' color='white'><b>Oouchh.. you failed to Log In </b></font></br>";
    }
    }
    }
    ?>
    </p>
    </span>

    <p><label><font color="#FFFFFF" face="Monotype Corsiva" size="+2">Forgot Password : </font></label>&nbsp;
    <a href="">click here </a></p>
    <label><font color="#FFFFFF" face="Monotype Corsiva" size="+2">New Account/font></label>&nbsp;
    <label><input type="image" name="newacc" id="newacc" src="/create_new_account_off1.PNG" /></label>
    </form>
    </td>
    </tr>
    </table>
    </body>
    </html>

    please reply me soon

    thanks in advance

  2. #2
    SitePoint Evangelist priti's Avatar
    Join Date
    Aug 2006
    Location
    India
    Posts
    488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey

    is this valid ??

    <input type="image" name="signin" id="signin" src="/hdr_signin1.PNG" />

    --------

    for clikable images we do following

    <a href="path"><img src="path/to/image"/></a>

    so when u click image it will go to path specified in href.

  3. #3
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi priti

    as in my code it should check the conditions then it should open the next url
    but it is not working
    don't know y?

  4. #4
    SitePoint Evangelist priti's Avatar
    Join Date
    Aug 2006
    Location
    India
    Posts
    488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dear will u please explain the functionality you looking at ?


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
  •