Jump to content

saradrungta

Members
  • Posts

    42
  • Joined

  • Last visited

Everything posted by saradrungta

  1. hi friends, i hv written following code. the problem i m facing is without displaying the alert box the page get redirected. instead i want that when user click 'ok' then the page should be redirected. pls help...what should i change <?php require("config.php"); if(isset($_POST['submit'])){ if(!empty($_POST['uname'])&&($_POST['password'])){ $uname = $_POST['uname']; $password = $_POST['password']; $sql = "SELECT uid, pass FROM user WHERE(uid='$uname' AND pass='$password')"; $result = mysql_query($sql) or die (mysql_error()); $numrow = mysql_num_rows($result); $rows=mysql_fetch_assoc($result); if(!$numrow){ echo '<script>alert("Invalid Username/Password");</script>'; header("Location:index.php"); } else{ $_SESSION['uid']=$rows['uid']; echo $_SESSION['uid']; header("Location:member.php"); } } } ?>
  2. it's working fine in my stsyem.....
  3. if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/", $email)){ echo "invalid"; } else{ echo $email; }
  4. try this <?php if(isset($_POST['submit'])){ $folder="uploaded_files/"; $userfile=$_FILES['ufile']['tmp_name']; $filename=basename($_FILES['ufile']['name']); $serverpath="$folder$filename"; $x=move_uploaded_file($userfile,$serverpath); if($x){ echo "File Uploaded Sucessfully"; } else{ echo "file not uploaded"; } } ?> <html> <body> <form enctype="multipart/form-data" method=post> file<input type=file name=ufile><input type=submit name=submit value=UPLOAD> </form> </body> </html>
  5. thanks.... actually i was using ID instead of CLASS.....
  6. hi friends.... i hv designed 2 pages and a stylesheet. in both pages i hv displayed fieldset. i want both the fieldset in pages should be different (eg width: 20em; & width: 30em;) can any one help me with this.... Thanks fieldset.contact { width: 30em; } fieldset.login { width: 20em; } fieldset { border: 1px solid #781351; background-image: url(images/bg-box-s2.JPG); } this code is not doing
  7. hi friends.... i m working on a project i.e. online examination. for that i m building a data base of php objective type questions. can any one provide me with some source. thanks
  8. hi guys... is it nessary to use session_register('USERID') while i directly use $_SESSION['USERID']="xyz" pls guide. thanks
  9. // for displaying data while($rows=mysql_fetch_array($result)){ ?> <tr> <td><input type="checkbox" name= "delid[]" value="<?php echo $rows['UID']; ?>"></td> <td><input type="hidden" name="uid" value="<?php echo $rows['UID']; ?>" /> <input type="submit" name="edit" value="EDIT"></td> <td><?php echo $rows['UID']; ?></td> <td><?php echo $rows['Name']; ?></td> <td><?php echo $rows['age']; ?></td> <td><?php echo $rows['city']; ?></td> </tr> <?php } ?> <tr> <td colspan="5" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="Delete"></td> </tr> <?php //checking edit button value if(isset($_POST['edit'])){ echo $_POST['uid']; } // Check if delete button active, start this if($_POST['delete']){ $del_id = $_POST['delid']; foreach($_POST['delid'] as $id){ $delque="delete from studentrec where(UID='$id')"; $q=mysql_query($delque) or die(mysql_error()); printf("Records deleted: %d\n", mysql_affected_rows()); }
  10. i m using beetel router do i need to change something more.... as when i access my IP address from computer it opens Router page.
  11. hi friends i m using wamp server. can any one tell, how can i allow other users over internet to view my projects using my IP address. pls suggent.... thanks
  12. hi friends..... thanks for ur reply... i found a solution. <input type="button" Value="edit" onClick="document.location.href='adelete.php?euid=<?php echo $rows['UID'];?>' " />
  13. <?php // Connect to server and select databse. mysql_connect("localhost","root","")or die("cannot connect"); mysql_select_db("sarad")or die("cannot select DB"); //Display all the Records// $sql="SELECT * FROM studentrec"; $result=mysql_query($sql); mysql_num_rows($result); ?> <form method="post" action="adelete.php"> <table width="100%" border="1" cellpadding="3" cellspacing="1"> <tr> <th colspan="5" align="center">Delete multiple rows in mysql</th> </tr> <tr> <th>DELETE</th> <th>Edit</th> <th>Id</th> <th>Name</th> <th>Age</th> <th>City</th> </tr> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td><input type="checkbox" name= "delid[]" value="<?php echo $rows['UID']; ?>"></td> <td><input type="hidden" name="uid" value="<?php echo $rows['UID']; ?>" /> <input type="submit" name="edit" value="EDIT"></td> <td><?php echo $rows['UID']; ?></td> <td><?php echo $rows['Name']; ?></td> <td><?php echo $rows['age']; ?></td> <td><?php echo $rows['city']; ?></td> </tr> <?php } ?> <tr> <td colspan="5" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="Delete"></td> </tr> <?php //checking edit button value if(isset($_POST['edit'])){ echo $_POST['uid']; } // Check if delete button active, start this if($_POST['delete']){ $del_id = $_POST['delid']; foreach($_POST['delid'] as $id){ $delque="delete from studentrec where(UID='$id')"; $q=mysql_query($delque) or die(mysql_error()); printf("Records deleted: %d\n", mysql_affected_rows()); } // if successful redirect to delete_multiple.php if($q){ echo "<meta http-equiv=refresh content=0;URL=adelete.php>"; } } mysql_close(); ?> </table> </form> </td> </tr> </table>
  14. thanks for ur advise, but i m still facing a problem When i display all records with ur code it stores the last UID of my records in all the EDIT button....
  15. <a href="newwindow.php" target ="_self" > use this i hope this 'll solve ur problem
  16. actually i m displaying all the records in my DB, and want to allow user to see and edit any data which he wish to edit. but the code i mentioned, it display the UID on BUTTON, instead i want that it should display EDIT on button and pass UID in $_POST['edit'] pls help
  17. SELECT * FROM thelist WHERE pskill = 'carpentry' OR sskill = 'carpentry'
  18. hello friends, i m designing a form i which i want to insert a edit button. and pass some value with it like 'UID' <input type="submit" name="edit" value="<?php echo $rows['UID']; ?>"> can some one help me..... thanks in advance.
  19. can some one help the below code doesn't download the fine b/t it download cade file only in which i save this code... pls help <?php header("content-type: Application"); header("content-Disposition: Attachment filename= \"uploded_files/sarad.jpg\""); ?> <html> <body> <form action=download.php method=post> <input type=submit value="Click here to Download"> </form> </body> </html>
  20. can some 1 help in finding error in below code its not deleting data from DB <?php // Connect to server and select databse. mysql_connect("localhost","root","")or die("cannot connect"); mysql_select_db("sarad")or die("cannot select DB"); $sql="SELECT * FROM studentrec"; $result=mysql_query($sql); $count=mysql_num_rows($result); ?> <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <td><form name="form1" method="post" action="adelete.php"> <table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td bgcolor="#FFFFFF"> </td> <td colspan="4" bgcolor="#FFFFFF"><strong>Delete multiple rows in mysql</strong> </td> </tr> <tr> <td align="center" bgcolor="#FFFFFF">#</td> <td align="center" bgcolor="#FFFFFF"><strong>Id</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Name</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>Age</strong></td> <td align="center" bgcolor="#FFFFFF"><strong>City</strong></td> </tr> <?php $count=1; while($rows=mysql_fetch_array($result)){ ?> <tr> <td align="center" bgcolor="#FFFFFF"><input name= "checkbox[]; ?>" type="checkbox" id="checkbox[]" value="<? echo $rows['UID']; ?>"></td> <td bgcolor="#FFFFFF"><?php echo $rows['UID']; ?></td> <td bgcolor="#FFFFFF"><?php echo $rows['Name']; ?></td> <td bgcolor="#FFFFFF"><?php echo $rows['age']; ?></td> <td bgcolor="#FFFFFF"><?php echo $rows['city']; ?></td> </tr> <?php $count++; } ?> <tr> <td colspan="5" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="Delete"></td> </tr> <?php // Check if delete button active, start this if($_POST['delete']){ for($i=0;$i<$count;$i++){ $del_id = $_POST['checkbox[$i]']; $sql = "DELETE FROM studentrec WHERE id='$del_id'"; $result = mysql_query($sql); } // if successful redirect to delete_multiple.php if($result){ echo "<meta http-equiv=\"refresh\" content=\"0;URL=xyz.php\">"; } } mysql_close(); ?> </table> </form> </td> </tr> </table>
  21. how can i restrict user to upload on some type of files. eg. only image file.
  22. sorry problem not solved "File Not Uploaded" is the output
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.