
psonawane
Members-
Posts
12 -
Joined
-
Last visited
psonawane's Achievements

Newbie (1/5)
0
Reputation
-
Hi trq. All I've tried is to echo out after submitting the form and before redirecting user to the same page. But it prints that thank you message on the top left corner and I did not want it to be. I wanted it to be printed exactly below the submit buttons. I've removed the echo for the code mentioned above. I wanted help about the same. But as muddy-funster says let me try Ajax code. Am a novice programmer. I've been programming jsp and Servlets but now learning php. Thanks for your helps.
-
Hi all below is my php code. its a contact form and all i want to do is to display thank you message below the submit button. Please help me what changes should I make? <!DOCTYPE html> <?php if (isset($_POST['submit'])) { mysql_connect("localhost", "root", "pranit"); mysql_select_db("simtech"); $cname = $_POST['cname']; $cont_no = $_POST['cont']; $email = $_POST['email']; $mess = $_POST['mess']; $sql = "insert into gen_enq(cname,cont_no,email_id,message)values('$cname','$cont_no','$email','$mess')"; if (mysqli_connect_errno()) { echo 'Failed To connect'; } $query = mysql_query($sql); if ($query) { header("Location: contact"); } else { die(mysql_error()); } } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Software Development Company - Malegaon, Website Designing Company</title> <link rel="stylesheet" href="main.css" type="text/css"> <link rel="icon" href="media/simtechlogo.png" type="image/png"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <meta name="keywords" content="WOW Slider, Slideshow jQuery Free Download, jQuery Slideshow Background" /> <meta name="description" content="WOWSlider created with WOW Slider, a free wizard program that helps you easily generate beautiful web slideshow" /> <!-- Start WOWSlider.com HEAD section --> <link rel="stylesheet" type="text/css" href="media/engine1/style.css" /> <script type="text/javascript" src="media/engine1/jquery.js"></script> <!-- End WOWSlider.com HEAD section --> <SCRIPT TYPE="text/javascript"> <!-- //Disable right click script //visit http://www.rainbow.arch.scriptmania.com/scripts/ var message="Sorry, right-click has been disabled"; /////////////////////////////////// function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false") // --> </SCRIPT> <SCRIPT TYPE="text/javascript"> <!-- //Disable select-text script (IE4+, NS6+) //visit http://www.rainbow.arch.scriptmania.com/scripts/ /////////////////////////////////// function disableselect(e){ return false } function reEnable(){ return true } //if IE4+ document.onselectstart=new Function ("return false") //if NS6 if (window.sidebar){ document.onmousedown=disableselect document.onclick=reEnable } // --> </SCRIPT> </head> <body> <script type="text/javascript"> $(document).ready(function(){ $('body').fadeIn(1000); }); </script> <center> <div class="wrapper"> <center> <p> <img src="media/sim1.png" height="200" width="400"> </p> </center> <div class="container"> <div class="navMenu"> <ul> <li><a href="index.php"><img src="media/home.png"></a></li> <li><a href="about.php">About Us</a></li> <li><a href="#">Services</a></li> <li><a href="#">Portfolio</a></li> <li><a href="#">Our Products</a></li> <li><a href="#">Downloads</a></li> <li><a href="#">Contact Us</a></li> </ul> </div> <div class="social"> <ul> <li><a href="#"><img src="media/facebook.png"></a></li> <li><a href="#"><img src="media/twitter.png"></a></li> <li><a href="#"><img src="media/linkedin.png"></a></li> </ul> </div> <div class="contss"> <ul> <li style="border-right: 1px solid #555555;"> <img src="media/Graphic2.jpg"><hr> Vrindavan Park, Sayali Appt. 60 Feet Road, <br> Near BSNL Exchange Office, Malegaon - 423203<br> Contact: 02554 - 250135 / +91 - 9096812185. </li> <li style="border-radius: 10px; background-image: url(media/menu.png); background-size: cover; margin-left: 30px;-webkit-box-shadow: 0 8px 6px -6px #00ADC5; -moz-box-shadow: 0 8px 6px -6px #00ADC5; box-shadow: 0 8px 6px -6px #00ADC5; "> <h3>Contact Us</h3> <form action="contact" method="post"> <table> <tr> <th>Your Name:</th> <td><input type="text" name="cname"></td> </tr> <tr> <th>Your Contact No:</th> <td><input type="text" name="cont"></td> </tr> <tr> <th>Your Email:</th> <td><input type="text" name="email"></td> </tr> <tr> <th>Your Message:</th> <td><textarea name="mess"></textarea></td> </tr> <tr> <th></th> <td><button type="submit" name="submit">✓ Submit</button></td> </tr> </table> </form> <br> </li> </ul> </div> </div> <br><br><br><br> <div class="footer"> <b>© Copyright 2013 - 14 : All Rights Reserved</b><br><hr> <table> <tr> <th> <a href="#">Home</a><br><br> <a href="#">About Us</a><br><br> <a href="#">Software Development</a><br><br> <a href="#">Web Designing</a><br> </th> <th> <a href="#">Web Application Development</a><br><br> <a href="#">Web Hosting</a><br><br> <a href="#">Search Engine Optimization</a><br><br> <a href="#">Android Development</a><br> </th> <th> <a href="#">Softwares</a><br><br> <a href="#">Web Sites</a><br><br> <a href="#">Web Applications</a><br><br> <a href="#">Software Products</a><br> </th> <th> <a href="#">Web Application Products</a><br><br> <a href="#">Android Products</a><br><br> <a href="#">Broucher Downloads</a><br><br> <a href="#"></a><br> </th> </tr> </table><br> </div> </center> </body> </html>
-
Hi everyone, I dont have any code to display as such today but just wanted to discuss or simply know about how can I keep the newspaper site updated daily? Like if I wish to design an admin panel for the press owners? What are your suggestions???
-
I have copied the code from my other project where i have not managed or added any session & it worked very well there. Please help me with managing sessions.,!!
-
Hi all following is my code. In this from the page 1 I'm trying to store data in the database and it will go to the next page which will store data and redirect user back to the page 1. But when user gets redirected it asks to enter the username & password again. I think I'm not able to manage session. Please Help me!! Page1.php <?php $username = $_POST['uname']; $password = $_POST['pass']; $_SESSION['uname'] = $username; if ($username && $password) { $con = mysql_connect("localhost", "root", "pranit") or die("Couldn't Connect"); mysql_select_db("rk_bookings") or die("Can't select DB"); $query = mysql_query("SELECT * FROM users WHERE uname = '$username'"); $numrows = mysql_num_rows($query); if ($numrows != 0) { while ($row = mysql_fetch_assoc($query)) { $dbusername = $row['uname']; $dbpassword = $row['pass']; } if ($username == $dbusername && $password == $dbpassword) { ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> <link rel="stylesheet" href="main.css" type="text/css"> </head> <body> <center> <div id="store"> <p><img src="media/rk_logo2.png" height="150" width="320"></p> <form action="storeSeat.php" method="post"> <table> <tr> <th>Enter Date</th> <td><input type="text" name="ddate" id="ddate"></td> </tr> <tr> <th>Company</th> <td><input type="text" name="company" value="Patel"></td> </tr> <tr> <th>Amenities</th> <td><input type="text" name="aminities" value="Seating, NON AC"></td> </tr> <tr> <th>Depart</th> <td><input type="text" name="depart" value="11:30"></td> </tr> <tr> <th>Arrive</th> <td><input type="text" name="arrive" value="06:00"></td> </tr> <tr> <th>Duration</th> <td><input type="text" name="duration" value="06:30"></td> </tr> <tr> <th>Price</th> <td><input type="text" name="price" value="300"></td> </tr> <tr> <th>Start</th> <td><input type="text" name="start" value="Malegaon"></td> </tr> <tr> <th>End</th> <td><input type="text" name="end" value="Pune"></td> </tr> <tr> <th></th> <td><button type="submit" name="store">Store</button></td> </tr> </table> </form> </div> <?php } else echo "<b style='color:white; font-size:60px; font-family:sans-serif;'>Incorrect Password</b>"; } else die("That User Doesn't exist"); } else die("Please Enter Username or password"); ?> Page 2.php ?php session_start(); $host = "localhost"; $uname = "root"; $pass = "pranit"; $db_name = "rk_bookings"; $tbl_name = "bus_details"; $company = $_POST['company']; $amenities = $_POST['aminities']; $deaprt = $_POST['depart']; $arrive = $_POST['arrive']; $duration = $_POST['duration']; $price = $_POST['price']; $start = $_POST['start']; $destination = $_POST['end']; if (isset($_SESSION['uname'])) { mysql_connect("$host", "$uname", "$pass") or die("cannot connect"); mysql_select_db("$db_name") or die("cannot select DB"); $seat_no = 1; $no_of_times = 1; $url = "Location: login.php"; echo "User : " . $_SESSION['uname']; do { $sql = "insert into $tbl_name(company, aminities, depart, arrive, duration, price, start, destination, seat_no) values ('$company','$amenities','$deaprt','$arrive','$duration','$price','$start','$destination',$seat_no)"; $result = mysql_query($sql); $seat_no++; $no_of_times++; } while ($no_of_times <= 42); if ($result) { echo "<b style = 'font-family: sans-serif; font-size: 20px; color: #00ADC5'>Thank you for your feedback / query. We will get back to you soon!</b>"; } else { echo "Error" . mysql_error(); } header($url); } ?> Please tell me where am going wrong?
-
K now see this <body bgcolor="#CFE5FC"> <form action="#"> <center> <div id="wrapper"> <img src="media/rk_logo2.png" width="300" height="150"> <div id="cust"> <h3>Enter Your Details Below</h3> <table> <tr> <th>Name:</th> <td><input type="text" name="cname"></td> <th>Email:</th> <td><input type="text" name="cmail"><br></td> <th>Contact No:</th> <td><input type="text" name="ccont"><br></td> </tr> <tr> <th></th> <td></td> <th></th> <td><p>Your Tickets Will Be Mailed to This Address</p></td> <th></th> <td><p>You Will Get A Confirmation Text On This Number</p></td> </tr> </table> </div><hr> <div id ="bus"> <p><i><u>RK Patel From Malegaon To Mumbai</u></i></p> <table> <tr> <th><input type="checkbox" name="B" id="B"> B</th> <th><input type="checkbox" name="B" id="B">C</th> <th><input type="checkbox" name="B" id="B">2</th> <th><input type="checkbox" name="B" id="B">3</th> <th><input type="checkbox" name="B" id="B">10</th> <th><input type="checkbox" name="B" id="B">11</th> <th><input type="checkbox" name="B" id="B">18</th> <th><input type="checkbox" name="B" id="B">19</th> <th><input type="checkbox" name="B" id="B">26</th> <th><input type="checkbox" name="B" id="B">27</th> <th><input type="checkbox" name="B" id="B">34</th> <th><input type="checkbox" name="B" id="B">35</th> </tr> <tr> <th><input type="checkbox" name="B" id="B">A</th> <th><input type="checkbox" name="B" id="B">D</th> <th><input type="checkbox" name="B" id="B">1</th> <th><input type="checkbox" name="B" id="B">4</th> <th><input type="checkbox" name="B" id="B">9</th> <th><input type="checkbox" name="B" id="B">12</th> <th><input type="checkbox" name="B" id="B">17</th> <th><input type="checkbox" name="B" id="B">20</th> <th><input type="checkbox" name="B" id="B">25</th> <th><input type="checkbox" name="B" id="B">28</th> <th><input type="checkbox" name="B" id="B">33</th> <th><input type="checkbox" name="B" id="B">36</th> </tr> <tr> <th style="border: none; background: none;"></th> <th style="border: none; background: none;"></th> <th style="border: none; background: none;"></th> <th style="border: none; background: none;"></th> <th style="border: none; background: none;"></th> <th style="border: none; background: none;"></th> <th style="border: none; background: none;"></th> <th style="border: none; background: none;"></th> <th style="border: none; background: none;"></th> <th style="border: none; background: none;"></th> <th style="border: none; background: none;"></th> <th><input type="checkbox" name="B" id="B">37</th> </tr> <tr> <th><input type="checkbox" name="B" id="B">E</th> <th><input type="checkbox" name="B" id="B">H</th> <th><input type="checkbox" name="B" id="B">J</th> <th><input type="checkbox" name="B" id="B">5</th> <th><input type="checkbox" name="B" id="B">8</th> <th><input type="checkbox" name="B" id="B">13</th> <th><input type="checkbox" name="B" id="B">16</th> <th><input type="checkbox" name="B" id="B">21</th> <th><input type="checkbox" name="B" id="B">24</th> <th><input type="checkbox" name="B" id="B">29</th> <th><input type="checkbox" name="B" id="B">32</th> <th><input type="checkbox" name="B" id="B">38</th> </tr> <tr> <th><input type="checkbox" name="B" id="B">F</th> <th><input type="checkbox" name="B" id="B">G</th> <th><input type="checkbox" name="B" id="B">I</th> <th><input type="checkbox" name="B" id="B">6</th> <th><input type="checkbox" name="B" id="B">7</th> <th><input type="checkbox" name="B" id="B">14</th> <th><input type="checkbox" name="B" id="B">15</th> <th><input type="checkbox" name="B" id="B">22</th> <th><input type="checkbox" name="B" id="B">23</th> <th><input type="checkbox" name="B" id="B">30</th> <th><input type="checkbox" name="B" id="B">31</th> <th><input type="checkbox" name="B" id="B">39</th> </tr> </table> </div> <hr> <div id="pay"> <h3>Payment Selection</h3> <p><u>We Accept</u></p> <pre><img src="media/visa.jpg" height="40" width="70"> <img src="media/MasterCard.gif" height="40" width="70"> <img src="media/american.jpg" height="40" width="70"></pre> <div id="pay-table"> <table> <tr> <th> <h4>Credit Cards</h4><hr> <table style="border: 1px solid gray;"> <tr style="background-color: silver; border-right: 1px solid gray; "> <th>Enter Your Details</th> <td></td> </tr> <tr> <th>Card Type:</th> <td> <select name="card_type"> <option></option> <option>Visa</option> <option>Master Card</option> <option>American Express</option> </select> </td> </tr> <tr> <th>Card Number:</th> <td><input type="text" name="card_number"></td> </tr> <tr> <th>Name on Card:</th> <td><input type="text" name="card_name"></td> </tr> <tr> <th>Expiry Date:</th> <td> <select name="expiry_month"> <option>---</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> </select> <select name="expiry_year"> <option>-------</option> <option>2013</option> <option>2014</option> <option>2015</option> <option>2016</option> <option>2017</option> <option>2018</option> <option>2019</option> <option>2020</option> <option>2021</option> <option>2022</option> <option>2023</option> <option>2024</option> <option>2025</option> <option>2026</option> <option>2027</option> <option>2028</option> <option>2029</option> <option>2030</option> <option>2031</option> <option>2032</option> <option>2033</option> <option>2034</option> <option>2035</option> <option>2036</option> <option>2037</option> <option>2038</option> <option>2039</option> <option>2040</option> </select> </td> </tr> <tr> <th>CVV Number:</th> <td><input type="text" name="cvvno"></td> </tr> <tr> <th>Issuing Bank</th> <td><input type="text" name="bank"></td> </tr> </table> </th> <th> <h4>Debit Cards</h4><hr> <table style="border: 1px solid gray;"> <tr style="background-color: silver;"> <th>Enter Your Details</th> <td></td> </tr> <tr> <th>Card Type:</th> <td> <select> <option></option> <option>Visa</option> <option>Master Card</option> <option>American Express</option> </select> </td> </tr> <tr> <th>Card Number:</th> <td><input type="text" name="cardno"></td> </tr> <tr> <th>Name on Card:</th> <td><input type="text" name="cardname"></td> </tr> <tr> <th>Expiry Date:</th> <td> <select name="expiry_month"> <option>---</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> </select> <select name="expiry_year"> <option>-------</option> <option>2013</option> <option>2014</option> <option>2015</option> <option>2016</option> <option>2017</option> <option>2018</option> <option>2019</option> <option>2020</option> <option>2021</option> <option>2022</option> <option>2023</option> <option>2024</option> <option>2025</option> <option>2026</option> <option>2027</option> <option>2028</option> <option>2029</option> <option>2030</option> <option>2031</option> <option>2032</option> <option>2033</option> <option>2034</option> <option>2035</option> <option>2036</option> <option>2037</option> <option>2038</option> <option>2039</option> <option>2040</option> </select> </td> </tr> <tr> <th>CVV Number:</th> <td><input type="text" name="cvvno"></td> </tr> <tr> <th>Issuing Bank</th> <td><input type="text" name="bank"></td> </tr> </table> </th> </tr> </table> <button>Proceed For Payment</button> <p style="width: 600px;">Note: After clicking on the "Proceed For Payment" button you might be taken to your bank's website for 3D secure authentication.</p> </div> <h3> </h3> </div> </div> </center> </form> </body> rest all is stored normally but the check box's value will be stored as an array..!! is That Possible in PHP? Please dont mind but am a complete newbie for php
-
Hi all. First of all I'm sorry that I'm not able to put the code here right now as am in my phone. But all I need to do is to store the checkbox value into the database table. Can anyone plz help me out with this.? And if possible can I check multiple checkboxes and store their values into the table Consider the following case. I want to Visit: <input type = "checkbox" name = "states" id = "states" value="states">United states <input type ="checkbox" value = "uk" id="uk" name="uk">united kingdom <br> <input type = "submit" name ="submit"> store me How can I do this. Plz help me. As I want to store that particular value of a checkbox.
-
Trying to update table using isset() function shows nothing
psonawane replied to psonawane's topic in PHP Coding Help
and one more thing which I dint understand is in if (isset($_POST['update'])) what does update mean? -
Trying to update table using isset() function shows nothing
psonawane replied to psonawane's topic in PHP Coding Help
Hi as per ur instruction I tried this <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> <link rel="stylesheet" href="main.css" type="text/css"> </head> <body background="media/dark_blue_background-wallpaper-1920x1200.jpg"> <center> <?php session_start(); if ($_SESSION['uname']) { ?> <div id="bus"> <p><img src="media/rk_logo2.png" height="100" width="220"></p> <ul> <li style="float: right; padding-right: 10px; font-family: sans-serif; font-weight: bold;">You are Logged in as, <?php echo "" . $_SESSION['uname'] . "!"; ?></li> </ul><br> <div id="menu"> <ul> <li><a href="add.php">Add Bus and Service</a></li> <li><a href="edit.php">Change Bus and Service</a></li> <li><a href="del.php">Delete Bus and Service</a></li> <li><a href="show.php">View Bus and Service</a></li> </ul> </div> <?php } $host = "localhost"; $uname = "root"; $pass = "pranit"; $db_name = "rk_bookings"; $tbl_name = "bus_details"; if (empty($_POST['update'])) { $rate = $_POST['rate']; $coname = $_POST['coname']; $dest = $_POST['destination']; mysql_connect("$host", "$uname", "$pass") or die(mysql_error()); mysql_select_db($db_name); $sql1 = "UPDATE $tbl_name SET price='$rate' WHERE company='$coname' AND destination='$dest'"; $result = mysql_query($sql1); if ($result) { echo "Successful"; } else { echo mysql_error(); } } ?> </body> </html> and its now saying Notice: Undefined index: rate in C:\xampp\htdocs\RK_files\update.php on line 40 Notice: Undefined index: coname in C:\xampp\htdocs\RK_files\update.php on line 41 Notice: Undefined index: destination in C:\xampp\htdocs\RK_files\update.php on line 42 -
Trying to update table using isset() function shows nothing
psonawane replied to psonawane's topic in PHP Coding Help
Nothing Happened senior!!! -
Hi all am trying to update the database table by submitting a form and used isset (0 function but is shows nothing what can I do? here's my code!!! <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> <link rel="stylesheet" href="main.css" type="text/css"> </head> <body background="media/dark_blue_background-wallpaper-1920x1200.jpg"> <center> <?php session_start(); if ($_SESSION['uname']) { ?> <div id="bus"> <p><img src="media/rk_logo2.png" height="100" width="220"></p> <ul> <li style="float: right; padding-right: 10px; font-family: sans-serif; font-weight: bold;">You are Logged in as, <?php echo "" . $_SESSION['uname'] . "!"; ?></li> </ul><br><hr> <?php } $host = "localhost"; $uname = "root"; $pass = "pranit"; $db_name = "rk_bookings"; $tbl_name = "bus_details";[/size][/color][/font] [font="Verdana, Geneva, sans-serif"][color="#333333"][size=3] mysql_connect("$host", "$uname", "$pass") or die("cannot connect"); mysql_select_db("$db_name") or die("cannot select DB");[/size][/color][/font] [font="Verdana, Geneva, sans-serif"][color="#333333"][size=3] $coname = $_POST['coname']; $dest = $_POST['destination']; $sql = "SELECT * FROM $tbl_name WHERE company='$coname' and destination='$dest'"; $result = mysql_query($sql) or die(mysql_error()); $rows = mysql_fetch_array($result, MYSQLI_ASSOC); ?> <div id="disp"> <form action="update.php"> <table> <tr> <th>Company Name</th> <th>Bus Facilities</th> <th>Depart Time</th> <th>Arrival Time</th> </tr> <tr> <td><input type="text" name="coname" value="<?php echo $rows['company']; ?>"></td> <td><input type="text" name="aminities" value="<?php echo $rows['aminities']; ?>"></td> <td><input type="text" name="depart" value="<?php echo $rows['depart']; ?>"></td> <td><input type="text" name="arrive" value="<?php echo $rows['arrive']; ?>"></td> </tr> <tr> <th>Duration</th> <th>Rate</th> <th>From</th> <th>To</th> </tr> <tr> <td><input type="text" name="duration" value="<?php echo $rows['duration']; ?>"></td> <td><input type="text" name="rate" value="<?php echo $rows['price']; ?>"></td> <td><input type="text" name="start" value="<?php echo $rows['start']; ?>"></td> <td><input type="text" name="destination" value="<?php echo $rows['destination']; ?>"></td> </tr> <tr> <th style="border: none; background: none;"></th> <td></td> <th style="border: none; background: none; float: right;"></th> </tr> </table> <button type="submit" name="submit">Update!</button><br><br><br> </form> <strong><a href="home.php">Click Here to Go Back!</a></strong> <br><br><br> </div> </body> </html>[/size][/color][/font] [font="Verdana, Geneva, sans-serif"][color="#333333"][size=3]