Jump to content

zed420

Members
  • Posts

    160
  • Joined

  • Last visited

    Never

Everything posted by zed420

  1. Hi All Can anyone please point me in right direction, I cannot post “custname1” and “des1”in this form? Why??? <?php session_start(); ?> <!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> <link href="myStyle2.css" rel="stylesheet" type="text/css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Instant Booking</title> <style type="text/css"> body { background:url(Images/aurora1pu.jpg); } </style> <script type="text/javascript"><!-- var lastDiv = ""; function showDiv(divName) { // hide last div if (lastDiv) { document.getElementById(lastDiv).className = "hiddenDiv"; } if (divName && document.getElementById(divName)) { document.getElementById(divName).className = "visibleDiv"; lastDiv = divName; } } //--> </script> </head> <body> <? $id = $_POST['id']; $passType = $_POST['passType']; $vehicleType = $_POST['vehicleType']; $roomNo = $_POST['roomNo']; $tableNo = $_POST['tableNo']; $noOfVehicle = $_POST['noOfVehicle']; if ($_POST['submit']){ echo "$passType<br>"; echo "$vehicleType<br>"; echo "$tableNo<br>"; echo "$roomNo<br>"; echo "$noOfVehicle<br>"; echo "$custname1<br>"; echo "$des1<br>"; } ?> <form name="action" id="action" method="post" action="<?=$_SERVER['PHP_SELF']?>"> <div class="smallerText"><center> <table width="55%" border="0" cellspacing="3" cellpadding="3"> <tr> <td width="3%"><b>Passenger Type</b></td> <td width="3%"><b>Vehicle Type</b></td> <td width="3%"><b>Room No</b></td> <td width="3%"><b>Table No</b></td> <td width="3%"><b>No. of Vehicle</b></td> </tr> <tr> <td><select name="passType" id="passType" > <option value="customer" selected="selected">Customer</option> <option value="staff">Staff</option> </select></td> <td><select name="vehicleType" id="vehicleType"> <option value="4seater">4 Seater</option> <option value="7seater">7 Seater</option> </select></td> <td><input name="tableNo" type="text" id="tableNo" size="10" /></td> <td><input name="roomNo" type="text" id="roomNo" size="10" /></td> <td><select name="noOfVehicle" id="noOfVehicle" onchange="showDiv(this.value);"> <option value="">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> </select></td> </tr></table> </center> <p id="1" class="hiddenDiv" align="center"> <table width="541" border="0" cellspacing="3" cellpadding="3"> <tr> <td width="103">Customer Name</td> <td width="144"><input type="text" name="custname1" id="custname1" /> </td> <td width="64">Destination</td> <td width="153"><input type="text" name="des1" id="des1" /> </td> </tr> </table></p> <center><input name="submit" type="submit" value="Submit Request"/> <input name="reset" type="reset" value="Reset" /></center> </div></form> </body> </html> Thanks Zed
  2. Thanks for the reply but I'm getting this error message; Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\t_line_ph\newsDetail2.php on line 12 Thanks Zed
  3. Hi All Can someone point me in right direction please. I'm trying to send data from one page to another by using Checkboxes. First why doesn't header take the id and news to newsDisplay.php page even thou by clicking display button the page comes up but WITHOUT the id and news rows. The second code works but I have to make TWO attempts, I check the checkbox and click nothing happens but when I do the same again it works and does produces right result. ??? ??? if($_POST['display']) { foreach($_POST as $id) { //header('location: newsDisplay2.php?id=$id&news=$news'); echo "<form action=\"newsDisplay2.php?id=$id&news=$news\" method=\"POST\">"; } } Thanks in advance Zed
  4. Thanks for the reply Barand It didn't work . Zed
  5. Hi All Can someone tell me if this is possible or do I need to wake up. I'm trying to delete some records from three different tables at once via check boxes, tabls don't have any join. This doesn't give me any error but not working either. It does work if I use one table. some help will be greatley appreciated. if($_POST['delete']) { foreach($_POST as $job_id) { mysql_query("DELETE FROM job_tb,blockBook,blockBook2 WHERE job_tb.job_id='$job_id' OR blockBook.job_id= '$job_id' OR blockBook2.job_id= '$job_id'"); if (mysql_affected_rows() > 0) { print "<font color=red size=2>Job No. = $Job_id has been deleted</font><p>"; } } } Thanks Zed
  6. Maq thank you blue, all sorted Many thanks Zed
  7. sasa YOU ARE A MAGIC MAN it worked, thank you Zed
  8. Thanks for quick reply It didn't work still the same, coming out with three results. Zed
  9. Hi All Can some please tell me what is wrong with this query it's bringing out the Duplicate results according to $pagesize . As it is now it's bringing out same result three times. Why??? I have inserted the query into phpMyAdmin its working fine bringing out one result. Some help will be greatly appreciated. Thanks $pagesize = 3; $recordstart1 = (isset($_GET['recordstart'])) ? $_GET['recordstart'] : 0; $query1 = "SELECT * FROM job_tb,user WHERE job_tb.status = 'No' OR job_tb.cust_address = 'Cancel' AND user_id = id ORDER BY job_id DESC LIMIT $recordstart, $pagesize"; $result1 = mysql_query($query1)or die(mysql_error()); Thank in advance Zed
  10. Thanks mtoynbee it worked. thank you Zed
  11. Thanks for quick reply, this is the error I'm getting Fatal error: Call to undefined function int_val() in C:\xampp\htdocs\t_line_ph\memberProAdmin.php on line 127
  12. Hi All Can someone please point out what am I doing wrong here, the query should display one set of results but its showing me THREE same results even thou there is only ONE set of results in the database so the insert query is fine it hasn't inserted the duplicate data. Some help will appreciated. Thanks function normalJob(){ $id = $_GET['id']; $query = "SELECT DISTINCT job_tb.job_id,job_tb.dateTime,job_tb.cust_name,job_tb.cust_address,job_tb.des,job_tb.typeOfbooking, user.id FROM job_tb,user WHERE job_tb.user_id = '$id'"; $result = mysql_query($query)or die(mysql_error()); ?><div class="smallerText"> <b>These are the jobs you have booked so far. Please click on Job ID to view further details about the job</b> <TABLE BORDER=0 WIDTH=100% CELLSPACING=3 CELLPADDING=3 ALIGN=CENTER bgcolor="#CCCCCC"> <TR bgcolor="#FFFFCC" align="center"> <td width="10%"><font color=red><b>Job No.</b></font></TD> <td width="15%"><font color=red><b>Date/Time</b></font></TD> <td width="15%"><font color=red><b>Name</b></font></TD> <td width="25%"><font color=red><b>Pick up Address</b></font></TD> <td width="20%"><font color=red><b>Destination</b></font></TD> <td width="20%"><font color=red><b>Booking Type</b></font></TD> </tr> <? while ($row = mysql_fetch_array($result)) { extract($row); echo "<tr > <td> <a href=\"javascript:open_window('detailNormal.php?job_id=$job_id');\">" . $row['job_id'] . "</a></td> <td>" . $row['dateTime'] . "</td> <td>" . $row['cust_name'] . "</td> <td>" . $row['cust_address'] . "</td> <td>" . $row['des'] . "</td> <td>" . $row['typeOfbooking'] . "</td> </tr>"; } ?></TABLE></div><? } normalJob(); Thanks Zed
  13. Hi All Can some please tell me what is wrong with my code it keeps giving me the error message even with right Email address. Some help will be greatly appreciated. if (myform.email.value != "/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/"){ alert("Invalid E-mail Address! Please re-enter."); myform.email.focus(); return (false) } return (true); } Thanks Zed
  14. zenag YOU ARE A STAR, What I fool I am not echoing out the $id. Thanks Zed
  15. Just as before, it empties the field instead of updating, when I'm checking in database id field is still there but news field is empty. Thanks Zed
  16. thanks for the reply Scott but that didn't work. ??? Zed
  17. Hi All Can anyone please tell me why doesn't my code UPDATE, it empties the field instead of updating. Any thoughts anyone. if($_POST['edit']) { foreach($_POST as $id) { $query = "SELECT * FROM news WHERE id = '$id'"; $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result); $query = "UPDATE news SET news='$news' WHERE id = '$id'"; $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); ?> <form action="<?php echo $PHP_SELF ?>" method="POST"> <center> <table width="100%" border="0"> <tr> <td> </td> <td >News</td> </tr> <tr> <td> </td> <td> <textarea name="news" cols="55" rows="15"><?php echo $row["news"]; ?></textarea> </td> </tr> <tr> <td> </td> <td ><input name="amend" type="Submit" value="Amend" onclick="return confirm ('You are about to change this record, Are you sure you want to do this?');"/></td> </tr> <tr><td> <center></center> </td> </table> </center> </form> <?php //Otherwise no rows found } // end if $rowsFound body else echo "No rows found"; } }else if($_POST['delete']) { foreach($_POST as $id) { // loop through the checked checkboxes mysql_query("DELETE FROM news WHERE id='$id'"); // deletes the record from the database if (mysql_affected_rows() > 0) { // execute query print "<font color=red size=2>No. = $id has been deleted</font><p>"; } } }else{ $query = "SELECT * FROM news ORDER BY id"; $result = mysql_query($query)or die(mysql_error()); ?> <div class="smallerText"> <form name="action" id="action" method="post" action="<?=$_SERVER['PHP_SELF']?>"> <TABLE BORDER=1 WIDTH=100% CELLSPACING=3 CELLPADDING=3 ALIGN=CENTER bgcolor="#F7956A"> <TR> <td width="1%" bgcolor="#F0C9BF"><font color=red><b>ID</b></font></TD> <td width="100%" bgcolor="#F0C9BF"><font color=red><b>News</b></font></TD> <td width="1%" bgcolor="#F0C9BF" ><font color=red></font></TD> </tr> <? while ($row = mysql_fetch_array($result)) { extract($row); echo "<tr > <td>" . $row['id'] . "</td> <td>" . $row['news'] . "</td> <td>" ?> <input type="checkbox" name="<?=$row[id]?>" id="<?=$row[id]?>" value="<?=$row[id]?>"/> <? "</TD> </tr>"; } ?></table> <br><center> <input type="submit" name="edit" id="edit" value="Edit Selected" /> <input type="submit" name="delete" id="delete" value="Delete Selected" onClick="return confirm('Are you sure, you want to Delete this record?');"/> </center> </form></div> <? } ?> Thanks Zed
  18. Hi All I like to create two functions on a same file and run them. I've got a file where I've run a select query so there are list of results. I would like to create two functions Delete and Edit on a same page, I have been trying but failing miserably, could anyone guide to right direction please. Thanks Zed
  19. Thanks for quick reply Zed
  20. Hi All Can someone please point out to me what is wrong with this code? Each time I refresh the page it inserts duplicate data in database. Other than that it doesn't give out any errors. Some help will be greatly appreciated. <? include("config.php"); function insert(){ $id = $_POST['id']; $news = $_POST['news']; if(empty($news)) error_message("You need to enter some text in news box!"); $query = "INSERT INTO news VALUES (NULL,'$news')"; $result = mysql_query($query)or die(mysql_error()); if (@mysql_query($query)) { echo '<p>Your Fresh news have been added. </p>'; } else { echo '<p>Error adding submitted Information: ' . mysql_error() . '</p>'; } } function form(){ ?> <center><h1>Add News</h1> <form name="action" id="action" method="post" action="<?=$_SERVER['PHP_SELF']?>"> <table width="60%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="18%"></td> <td width="82%"><input name="f_id" type="hidden" value="" /></td> </tr> <tr> <td></td> <td>Add fresh news here and click 'Submit' button</td> </tr> <tr> <td> </td> <td><textarea name="news" cols="55" rows="15"> </textarea></td> </tr> <tr> <td> </td> <td><input name="submit" type="submit" value="Submit" /> <input name="reset" type="reset" value="Reset" /></td> </tr> </table> </form></center> <? } if (! isset($_POST['submit'])){ form(); }else{ insert(); } Thanks Zed
  21. My sincere thanks go to all of you who helped me on this . Specially Blade280891 , iversonm and webguy1620 you guys were brilliant. Thank you Zed
  22. Hi All Is there way that I can save my sent mail that I have sent via php? Thanks Zed
  23. Don't worry fenway so was I... this is what I was looking for SELECT id , ( SELECT COUNT(*) FROM job1 WHERE user_id = user.id ) + ( SELECT COUNT(*) FROM job2 WHERE user_id = user.id ) + ( SELECT COUNT(*) FROM job3 WHERE user_id = user.id ) AS jobs_done FROM user Thanks Zed
  24. Hi All Can someone help me with creating a query please, I have three tables, User,job1,job2,job3 what I want is to know the count of each job a user has done. User table has primary key (id) all job tables have foreign key from User table (user_id). I just can not understand how to do it? This is what I have so far but it doesn't give the result I want ??? ??? $query = "SELECT job1.job_id,job2.job_id,job3.job_id, COUNT(*) FROM job1,job2,job3,user WHERE job1.user_id = user.id OR job2.user_id = user.id OR job3.user_id = user.id GROUP BY job_id"; $result = mysql_query($query) or die(mysql_error()); $num_rows = mysql_num_rows($result); echo "Normal: $num_rows<p>"; Many thanks well in advance Zed
  25. luca200 you're a star, Thank you my old china. Zed
×
×
  • 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.