Jump to content

Search the Community

Showing results for tags 'html'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. Hi there, newbie to this forum and newbie to PHP (infact I only started "attempting" to use it today) I have a contact form on https://scm-intranet.tees.ac.uk/users/l1071039/bobbin/order.html And I have a table set up on MySQL named "orderform" According to my order.html, the form data should be posted to order.php (code can be seen below) <?php $product = $_POST['product']; $productcomments = $_POST['productcomments']; $name = $_POST['name']; $address = $_POST['address']; $age = $_POST['age']; $delivery = $_POST['delivery']; ?> <?php $host=”mysql.scm.tees.ac.uk”; $user_name=”l1071039”; $pwd=”+i^RR9b7”; $database_name=”l1071039”; $db=mysql_connect($host, $user_name, $pwd); if (mysql_error() > “”) print mysql_error() . “<br>”; mysql_select_db($database_name, $db); if (mysql_error() > “”) print mysql_error() . “<br>”; ?> <?php $query = “insert into orderform (product, productcomments, name, address, age, delivery) values (‘” . $product . “‘, ” . $productcomments . “, ‘” . $name . “‘, ‘” . $address . “. $age . “. $delivery . “‘)”; $qresult = mysql_query($query); ?> However when I fill the form in I get a snippet of code? How do I get it so when the submit button is clicked, it returns to the Home Page, and how can I view the data that was inputted? Many Thanks in advance
  2. Hi I am new to PHP I am creating a web application which shows status of some sensors and controls some switches based on it. I do not have real sensors with me. How can I make another application which will simulate the sensors also receives the control commands from my applications and displays the command(in the test application) Can I make the test application also in PHP? Can I run my app and test app in two different browsers in same computer and test it? How can I manage the connection between them? Regards Ashok
  3. How to make border appear on the left and right sides of text? Let's say we have a div 200px x 100px with red border and ID of "container" <style type="text/css"> *{padding:0; margin:0;} #container{ width:200px; height:100px; border:2px solid red; } </style> <div id="container"> <p>Happy Potter</p> He was an awesome wizard! </div> Now we want to put the paragraph "Happy Potter" on the top of the div box between the red border. We do that by defining negative margin which will push up the paragraph like this: #container p{ margin-top:-15px; } Now our paragraph is in between the border, almost how we want it to be. Next we want to push it in the middle. So we use margin-left: #container p{ margin-top:-15px; margin-left:50px; } I'd suggest adjusting the left margin i.e. the pushing to the center thing with the developer tools of your browser ( right click on top of the element and Firebug ( for FF ) or Google Chrome Developer tools will pop up ) Next we want to remove the border that is overlapping the text. We do that by defining width of the text and giving it a background color that is the same as the div container and the outside area of it like this: #container p{ margin-top:-15px; margin-left: 50px; width: 83px; background: pink; } In my case the background color of both the container div and the area outside of it was pink so I gave the same color to the paragraph after defining its width. We have the final result: And now we and Harry Potter are happy Final code: <style type="text/css"> *{padding:0; margin:0;} #container{ width:200px; height:100px; border:2px solid red; } #container p{ margin-top:-15px; margin-left: 50px; width: 100px; background: pink; } </style> <div id="container"> <p>Happy Potter</p> He was an awesome wizard! </div>
  4. Hey everyone im new to the forum, Okay so I need some help and maybe snippets on helping me achieve creating a program. The goal of this is to create a game which has the user guess which U.S. President corresponds to a randomly chosen term in office. A term (in office) constitutes a time range in which the U.S. President was the same. It turns out that the range of years of the term corresponds to a single President, but not vice-versa, because there is one U.S. President who had two terms. Generate the random term with this statement: $term = $terms[ mt_rand( 0, count($terms)-1 ) ]; so this is what i have. NOTE: THE OTHER PROGRAM'S PHP FILES ARE MADE. <?php require_once "include/Session.php"; $session = new Session(); if (!isset($session->valid)) { require_once "login.php"; exit(); } require_once "include/presidents.php"; // this is the list of the terms $terms = array_keys($term_presidents); // this is the list of all names (duplicates removed), sorted by last name $presidents = array_unique(array_values($term_presidents)); usort($presidents, "byLastName"); /* DO NOT MODIFY THE ABOVE LINES !!!!! */ $params = (object) $_REQUEST; print_r($params); /* Remaining Php handler code goes here */ ?> <!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" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"/> <title>Average Calculator</title> <style type="text/css"> body { padding: 20px; } #logout { position: absolute; top: 40px; right: 40px; } /* Add more style rules */ </style> </head> <body> <a id="logout" href="logout.php">Log out</a> <h2>President Guess Game</h2> <form action="program.php" method="get"> <button type="submit" name="reset" >New Game</button> </form> <!-- Add form and presentation code --> </body> </html>
  5. Hi all, I really need some help here please. I am going to include my code that I have. Problem is the select box is not loading from the database. The connection is there, that I have established. But the select box is just not populating. I have now been trying for the last 3 days and just cannot get this to work. I really need some help here please! I am sorry if this is a topic that has been thrashed to death, but I am at my wits end and just cannot get this to work no matter how hard I Google!! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Teaching Int Limited - Home</title> <meta name="title" content="Teaching Int Limited"> <link rel="shortcut icon" href="home/images/favicon.ico"> <meta http-equiv="Window-target" content="_top"> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> <meta http-equiv="Content-Language" content="en-gb"> <meta name="MSSmartTagsPreventParsing" content="TRUE"><!--Providing Quality English Teachers to Schools and Organisations--> <meta name="description" content="Providing Quality English Teachers to Schools and Organisations"> <meta name="Abstract" content="Providing Quality English Teachers to Schools and Organisations"> <meta name="keywords" content="TEFL,english,teacher"> <meta name="Robots" content="index, follow"> <meta name="Distribution" content="Global"> <meta name="Revisit-After" content="30 days"> <meta name="Rating" content="General"> <meta name="Reply-to" content="info@teaching-int.com"> <meta name="Owner" content="Teaching Int Limited"> <meta name="Author" content="Carter Langley"> <meta name="copyright" content="Teaching Int Limited - 2013"> <link href='http://fonts.googleapis.com/css?family=Great+Vibes' rel='stylesheet' type='text/css'> <link rel="stylesheet" type="text/css" href="form.css"> <link rel="stylesheet" type="text/css" href="header.css"> <link rel="stylesheet" type="text/css" href="site.css"> </head> <body> <?php include("header.php"); ?> <?php if(isset($_POST['add'])) { $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'password'; $dbbase = 'database'; $conn = mysql_connect($dbhost, $dbuser, $dbpass, $dbbase); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $campus_id = $_POST['campus_id']; $company_id = $_POST['company_id']; $campus_name = $_POST['campus_name']; $address_street = $_POST['address_street']; $address_city = $_POST['address_city']; $address_province = $_POST['address_province']; $address_postalcode = $_POST['address_postalcode']; $address_country = $_POST['address_country']; $main_tel = $_POST['main_tel']; $second_tel = $_POST['second_tel']; $main_email = $_POST['main_email']; $second_email = $_POST['second_email']; $sql = "INSERT INTO `teaching`.`campus` (`campus_id`, `company_id`,'campus_name','address_street','address_city','address_province','address_postalcode','address_country','main_tel','second_tel','main_email','second_email') VALUES ('NULL', '$company_id','$campus_name','$address_street','$address_city','$address_province','$address_postalcode','$address_country','$main_tel','$second_tel','$main_email','$second_email')"; $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not enter data: ' . mysql_error()); } echo "Entered data successfully. Redirecting in 2 seconds.\n"; mysql_close($conn); header('Refresh: 2; URL=edit.php'); } else { ?> <form method="post" action="<?php $_PHP_SELF ?>"> <table width="100%" align="left" border="0" cellspacing="1" cellpadding="2"> <tr> <td><label for="company_id">Company</label></td> <td> <select name="company_name"> <option value="">--- Select a Company ---</option> <?php $sql_select = "SELECT * FROM `company`"; $retval_selectcompany = mysql_query( $sql_select, $conn ); while($row = mysql_fetch_assoc($retval_selectcompany)) { echo '<option value='.$row["company_name"].'>'.$row["company_name"].'</option>'; } ?> </select> </td> </tr> <tr> <td><label for="campus_name">Campus Name</label></td> <td><input name="campus_name" type="text" id="campus_name"></td> </tr> <tr> <td><label for="address_street">Street Address</label></td> <td><input name="address_street" type="text" id="address_street"></td> </tr> <tr> <td><label for="address_city">City</label></td> <td><input name="address_city" type="text" id="address_city"></td> </tr> <tr> <td><label for="address_province">Province</label></td> <td><input name="address_province" type="text" id="address_province"></td> </tr> <tr> <td><label for="address_postalcode">Postal Code</label></td> <td><input name="address_postalcode" type="text" id="address_postalcode"></td> </tr> <tr> <td><label for="address_country">Country</label></td> <td><input name="address_country" type="text" id="address_country"></td> </tr> <tr> <td><label for="main_tel">Main Tel</label></td> <td><input name="main_tel" type="text" id="main_tel"></td> </tr> <tr> <td><label for="second_tel">Alt Tel</label></td> <td><input name="second_tel" type="text" id="second_tel"></td> </tr> <tr> <td><label for="main_email">Main Email</label></td> <td><input name="main_email" type="text" id="main_email"></td> </tr> <tr> <td><label for="second_email">Second Email</label></td> <td><input name="second_email" type="text" id="second_email"></td> </tr> <tr> <td></td> <td> <input name="add" type="submit" id="add" value="Add Campus"> </td> </tr> </table> </form> <?php } ?> </body> </html>
  6. I have HTML form linked with MYSQL database via PHP. If I submit this form, values will save in MYSQL database but not load into form. I see there old values so I have to refresh page to see desired values. I would like to see new values at form submission. *** I solved it when i put header("Location: edit.php?page=zakladni_udaje.php") ( = same as form action) on THE END OF ISSET form submit, it worked fine but I cant print message about success or fail after submiting. <?php ob_start(); session_start(); ?> <form action="edit.php?page=zakladni_udaje.php" method="post"> <?php $con = mysql_connect("localhost", "mairichovci", "ak41801") or die("Nelze se připojit k MySQL: " . mysql_error()); mysql_select_db("mairichovci") or die("Nelze vybrat databázi: ". mysql_error()); if($_SESSION['id'] > 0){ $profil_pomocny = mysql_query("SELECT * from profil where id=".$_SESSION['id'], $con); $profil = MySQL_Fetch_Assoc($profil_pomocny); $or_pomocny = mysql_query("SELECT * from osobaky where id=".$_SESSION['id'], $con); $or = MySQL_Fetch_Assoc($or_pomocny); $zobraz_pomocny = mysql_query("SELECT * from zobraz where id=".$_SESSION['id'], $con); $zobraz = MySQL_Fetch_Assoc($zobraz_pomocny); $id = $_SESSION['id']; $fce = $_POST['fce']; $email = $_POST['email']; $tel = $_POST['tel']; $position = $_POST['position']; $home = $_POST['home']; $omne = $_POST['omne']; if( isset ($_POST['uloz'])): $sql = "UPDATE profil SET fce = '$fce', email = '$email', tel = $tel, position = '$position', home = '$home', omne = '$omne' WHERE id = '$id'"; if (!mysql_query($sql)): die('Chyba: ' . mysql_error()); else: $message = "Údaje byly uloženy"; endif; mysql_close(); endif; echo '<div id="message">'.$message.'</div>'; ?> <table style = "margin-top: -1px" align="center" class="tabulka"> <tr> <td width="40%">Funkce:</td> <td><input type="text" name="fce" placeholder = "(např. Běžec - 800m, 1500m a delší)" maxlength="35" size="48" value="<?php echo $profil['fce']; ?>" class="vstupy" style="width: 350px"></td> </tr> <tr> <td></td> <td><input type="submit" name="uloz" value="Ulož" class="tlacitko2" style="width: 350px; margin-left:4px"></td> </tr> </table> </form> <?php } else{header("Location: prihlas.php");} ob_end_flush(); ?> Can anybody help me? Thanks in advance
  7. This is my first time posting sorry if anything is wrong. attached are my files in question but i don't know what is wrong. I want to show info from a .txt file or something similar within the website I'm working on. In AS3 it was easy to read and use an xml file but within html/php i cant remember. i want to be able to have to have the people im making the site for to be able to just update the text file and it will update the certain part of the site with the new information. Currently for some reason its commenting out part of my php code that i believe should read and echo the lines of the text file. this is the php code: <div id="home"> <h3>Updates From the Staff</h3> <p> <?php $file = fopen("news.txt", "r") or exit("Unable to open file!"); while(!feof($file)) { echo fgets($file). "<br>"; } fclose($file); ?> </p> </div><!-- End Nav Home --> this is what shows when i inspect element with chrome: <!--?php $file = fopen("news.txt", "r") or exit("Unable to open file!"); //Output a line of the file until the end is reached while(!feof($file)) { echo fgets($file). "<br--> its commenting out everything till the line brake and just showing "; } fclose($file); If someone could help me that would be amazing if not thats ok aswell.
  8. Hi everyone, i recently purchased the jbjobs component for joomla and have been modifying the views to suit my needs. i've reached a dead end though. i have a php bit that needs to be combined with a table, but i have not managed to make it work. can someone please lend a hand? thanks <?php $db=JFactory::getDBO(); $q = "select * from #__jbjobs_employer where user_id=".$job->employer_id; $db->setQuery($q); $employer_record = $db->loadObject(); '<table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td>';echo ($employer_record->show_addr == 'y')? "".$employer_record->street_addr : JText::_('JBJOBS_NOT_DISPLAYED').'</tr> <tr> <td>'; echo ($employer_record->show_location == 'y')? "".$employer_record->city.', '.$employer_record->state : JText::_('JBJOBS_NOT_DISPLAYED').'</td> </tr> <tr> <td>'; echo ($employer_record->show_phone == 'y')? "".$employer_record->primary_phone : JText::_('JBJOBS_NOT_DISPLAYED').'</td> </tr> <tr> <td>'; echo ($employer_record->show_fax == 'y')? "".$employer_record->fax_number : JText::_('JBJOBS_NOT_DISPLAYED').'</td> </tr> <tr> <td>'; $u = JFactory::getUser($job->employer_id); echo ($employer_record->show_email == 'y')? "".$u->email : JText::_('JBJOBS_NOT_DISPLAYED');'</td> </td> </tr> </table>' ?>
  9. I need help im building a website that is around social networking. each user has their own profile page. I have my registering code done. But now i want to add into it where when a user registers it adds a folder for them by their username. for example on my database side I have a folder called user. So when EX: Johnny registers then under that folder user he will have a folder for him called Johnny. Inside of johnnys folder is where I want to store his Pics ETC. The code I currently have is this just dont know how to make this mkdir happen. Please any response will help. <?php $submit = $_POST['submit']; // form data $fullname = strip_tags($_POST['fullname']); $username = strip_tags($_POST['username']); $password = strip_tags($_POST['password']); $confirmpassword = strip_tags($_POST['confirmpassword']); $date = date("Y-m-d"); if($submit) { //connect to database $connect = mysql_connect("XXXX", "XXXX", "XXXX"); mysql_select_db("XXXX"); $namecheck = mysql_query("SELECT username FROM user WHERE username='$username'"); $count = mysql_num_rows($namecheck); if ($count!=0) { die("Username is already taken!"); } // check for existance if($fullname&&$username&&$password&&$confirmpassword) { if($password==$confirmpassword) { if (strlen($username)>25||strlen($fullname)>25) { echo "Length of username or full name is too long!"; } else { if (strlen($password)>25||strlen($password)<6) { echo "Your password must be between 6 and 25 characters!"; } else { //register the user // encrypt password $password = md5($password); $confirmpassword = md5($confirmpassword); $queryreg = mysql_query(" INSERT INTO user VALUES('','$fullname','$username','$password','$date') "); die("You've successfully registered! <a href='index.php'>Click here to return to the login page!</a>"); } } } else echo "Your password does not match!"; } else echo "Please enter all fields!"; } ?> <html> <head> <meta charset="UTF-8"> <title>My Web Page</title> <link rel="stylesheet" href="style/style.css"> </head> <?php include_once("templates/template_pageTop.php"); ?> <body> <div id="pageMiddle"> <?php echo "<h1>Sign Up</h1>"; ?> <p> <form action='register.php' method='POST'> <table> <tr> <td> Full Name: </td> <td> <input type='text' name='fullname' value='<?php echo $fullname ?>'> </td> </tr> <tr> <td> Username: </td> <td> <input type='text' name='username' value='<?php echo $username ?>'> </td> </tr> <tr> <td> Password: </td> <td> <input type='password' name='password'> </td> </tr> <tr> <td> Confirm Password: </td> <td> <input type='password' name='confirmpassword'> </td> </tr> </table> <p> <input type='submit' name='submit' value='Create Account'> </form> </div> <?php include_once("templates/template_pageBottom.php"); ?> </body> </html>
  10. Hi There! I would like to contribute to some free software web project. I have good skills in PHP and frontend Html, CSS3 and JavaScript (jQuery). Could you guide me please? Where can I start from? Thank you very much!
  11. Can someone please help me with this. I'm pulling my hair out. I have manually uploaded videos via FTP into a folder on my website and I am trying to get a code that I can use with a button that will tell my database to update it with all the current files... then display the files on the page. Can anyone help? I have the database all set up and what I need to do is get is the movie name, upload date, and the file size into the database FROM the folder I have all the movies in. That way I can repull that information from the database back into the website and display it all. Currently I am displaying all the files in the folder onto a webpage and it's starting to get laggy and time consuming to load. Not to mention I have plans on using some sort of pagenation to help with load times. Let me know if anyone still doesn't understand my endgame here. I'm not sure I am exactly explaining this the right way. Joe
  12. Ok, so I have a main page that grabs data from a MySQL db and posts it into a dropdown menu see here: $sql = "SELECT * FROM 4000Series"; $result = $con->query($sql); print "Select your GPU: <select name='gpuId'>"; while ($row = $result->fetch_assoc()) { print "<option value='" .$row["id"] . "'>" . $row["gpu"] . "</option>"; } print "</select> </br>\n"; This works fine, from here I'm passing the POST data from the option values to a new page (basically the option values correspond directly to the "id" value in my SQL db). The values are passed onto the new page fine, but when I try to setup an SQL select statement to grab the row with the corresponding "id" value and print it out with a while loop I'm shooting a blank. Here's the code for the second page $id = $_POST['gpuId']; **Connect to sql db here** $sql = "SELECT * FROM 4000Series WHERE $id ='id'"; $result = $con->query($sql); echo "<table>"; while ($row = $result->fetch_assoc()){ echo "<tr><td>" . $row['id'] . "</td><td>" . $row['gpu'] . "</td></tr>"; } echo "</table>"; When I view the source it prints out the table tags but nothing in the while loop, any ideas?
  13. Hello, I'd like to know if someone know how I can do this. Example when sites use this function is in a store etc. You choose your product-types, if you for example chose a larger size, the price becomes higher and then it updates in real time. So what I mean is like, the number increases/decreases depending on the users selections, if he wants that or not that included, the number changes so he/she can see the exact price he needs to pay for the product. Like this for standard ---------------- 25$ --------------- but if I for example choose a larger size it automatically updates to ------------- 30$ ------------ I hope u understand what I mean. Thanks in advanced
  14. I have 8 rows/columns. They are; Key (which will never repeat), Name, HireDate, Seniority, VacHrs, PTOhrs, username AND password. After a successful login, this is my code; <?php $dbhost = '***7.000webhost.com'; $dbuser = 'a3674631_***'; $dbpass = 'm***'; $conn = mysql_connect("mysql17.000webhost.com", "a36***31_***n9", "****08"); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = 'SELECT Name, HireDate, Seniority, VacHrs, PTOhrs FROM att'; mysql_select_db('a3674631_test'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } while($row = mysql_fetch_array($retval, MYSQL_NUM)) { echo "Name :{$row[0]} <br> ". "Hire Date : {$row[1]} <br> ". "Seniority : {$row[2]} <br> ". "Vacation Hours Remaining : {$row[3]} <br> ". "PTO Hours Remaining : {$row[4]} <br> ". "--------------------------------<br>"; } mysql_free_result($retval); echo "Fetched data successfully\n"; mysql_close($conn); ?> The problem I’m having is it’s putting everyone’s data, all on one page together for everyone to see. This is private information, and Person A should not be able to see the values for person B. My table has 6 records(currently). If user A has a login of 111791, on a successful login, I would like it to say; Name: First Last HireDate: 04/04/2012 Seniority: 1 (dates that are sorted by earliest to latest) VacHrs: 45 PTOhrs: 18 Key, username & password will never show. Can someone tell me what I’m doing wrong. I know that I’m a noob, so please skip all the “I need read this book….or that tutorial”. I know I do, I’m going to, but in the mean time, I need to get this taken care of. I thank you sincerely for any help.
  15. Hello, I am writing an app and I am trying to include a feedback form. I have the form and php script written but it isn't working. Can somebody take a look at it and see if I am missing something? This is my first try at writing PHP. The form will submit via email and have five sections: name, email, city, what and comments. Submit to List Name: Email: City: What: Comments: The form shows up fine but it is the PHP I'm having trouble with. Below is the code I have so far for the HTML form and PHP file. I would like an email of the form to go to tim@akluk.com and another screen to pop up that says "Thank You" with a close button to take the viewer back to the home page. I appreciate any help I can get on getting this form to work. I am currently using Dreamweaver as my editor and I modified some code I found here: http://www.freecontactform.com/email_form.php. I am also referencing an O'Reilly book called Learning PHP, MySQL, JavaScript, & CSS. Thanks for your help! submit.htmlsubmit.php // Form HTML // "submit.html" <!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title>Submit to List</title> <meta name="viewport" content="width=device-width,user-scalable=no"> <link rel="stylesheet" href="jquery.mobile-1.0.css" /> <link href="jQueryAssets/jquery.ui.core.min.css" rel="stylesheet" type="text/css"> <link href="jQueryAssets/jquery.ui.theme.min.css" rel="stylesheet" type="text/css"> <link href="jQueryAssets/jquery.ui.button.min.css" rel="stylesheet" type="text/css"> <script src="jquery.js"></script> <script src="script.js"></script> <script src="jquery.mobile-1.0.js"></script> <script src="jQueryAssets/jquery-1.8.3.min.js" type="text/javascript"></script> <script src="jQueryAssets/jquery-ui-1.9.2.button.custom.min.js" type="text/javascript"></script> </head> <body> <div data-role="dialog"> <div data-role="header"> <h1>Submit to List</h1> </div> <div data-role="content"> <form action="submit.php" method="post" data-transition="none"> <div data-role="fieldcontain"> <label for="name">Name:</label> <input type="text" name="name" id="name" value="" required /> </div> <div data-role="fieldcontain"> <label for="email">Email:</label> <input type="email" name="email" id="email" value="" required /> </div> <div data-role="fieldcontain"> <label for="City">City:</label> <input type="text" name="city" id="city" value="" required /> </div> <div data-role="fieldcontain"> <label for="what">What:</label> <input type="text" name="what" id="what" value="" required /> </div> <div data-role="fieldcontain"> <label for="comments">Comments:</label> <textarea cols="40" rows="8" name="comments" id="comments"></textarea> </div> <input type="submit" value="Send" data-theme="a"> </form> </div> </div> </body> </html> // PHP Code // "submit.php" <!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title>Submission</title> <meta name="viewport" content="width=device-width,user-scalable=no"> <link rel="stylesheet" href="jquery.mobile-1.0.css" /> <script src="jquery.js"></script> <script src="script.js"></script> <script src="jquery.mobile-1.0.js"></script> </head> <body> <div data-role="dialog"> <div data-role="header"> <h1>Submit to List</h1> </div> <div data-role="content"> <?php if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "tim@akluk.com"; $email_subject = "List Suggestion"; function died($error) { // your error code can go here echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } // validation expected data exists if(!isset($_POST['name']) || !isset($_POST['email']) || !isset($_POST['city']) || !isset($_POST['what']) || !isset($_POST['comments'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $name = $_POST['name']; // required $email_from = $_POST['email']; // required $city = $_POST['city']; // required $what = $_POST['what']; // required $comments = $_POST['comments']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$name)) { $error_message .= 'The Name you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$city)) { $error_message .= 'The City you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$what)) { $error_message .= 'What you entered does not appear to be valid.<br />'; } if(strlen($comments) < 2) { $error_message .= 'The Comments you entered do not appear to be valid.<br />'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "Name: ".clean_string($name)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "City: ".clean_string($city)."\n"; $email_message .= "What: ".clean_string($what)."\n"; $email_message .= "Comments: ".clean_string($comments)."\n"; // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n". 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> Thanks for your suggestion. <a data-role="button" data-inverse="true" href="index.html">Close</a> </div> </div> </body> </html>
  16. I'm wondering the best way to handle validation messages for blind people, or sight-impaired. In my application, the situation on a save with errors is: User clicks save AJAX call goes to save the record; wait bar appears on the page's status bar Error is returned. The wait bar changes to show "Error on save" Below the status bar, each field name is listed with the appropriate error message. ("Name - Cannot be blank" or whatever) Within the fields themselves, the same message is shown again. (Next to the "Name" label on the page, "cannot be blank" would show up.) This functionality is great for sighted people. But for non-sighted, I'm not sure exactly how to handle it. Should an error become "selected" or something? I mean, it's just a div. I don't really have the answer. I posted this in general HTML but it could frankly be AJAX or JS or something. I think HTML is probably the most correct.
  17. could someone help me out am i right in saying i will need to use a for loop to output the answe code below: (creating a function) input 1 : 6 input 2 : 5 input 3 : 4 input 4 : 3 answer 666666 55555 4444 333 i do not know a lot i have been researching on internet for days an cant seem to cant anywhere. could someone help please
  18. I'm trying to learn jquery and ajax and not doing so well I am trying to pass the id from this dropdown when it is selected to the next ajax script and it is not working. Both scripts pull there data from the same table so if there is a way to do this with one script I would be interested. <select name="customer"id="customer" class="form-control input-sm responsetext" > </select> $( document ).ready(function() { $.ajax({ //create an ajax request to load_page.php type: "GET", url: "customer.php", dataType: "html", //expect html to be returned success: function(response){ $(".responsetext").html(response); //alert(response); } }); }); <?php include("connect.php"); $id = $_SESSION['profile']['id']; echo "<option value=''>SELECT A CUSTOMER</option>"; foreach($db->query("SELECT * FROM customers WHERE pid = '$id'") as $row) { echo "<option value=" . $row['id'] . ">" .$row['name'] . "</option>"; } The above script creates the select box and it works. Now I need the $row['id'] To be picked up by the next script to fill in the input field. <input name="contact" class="form-control input-sm contactresults" id="contact"> $(function() { // document.ready $("#id").on("change", function() { $.ajax({ url: "contact.php", type: "GET", data: { id: $(this).val() }, success: function(data) { $(".contactresults").html(data); } }); }); }); <?php include("connect.php"); $id= $row['id']; echo "<option value=''>SELECT A CUSTOMER</option>"; foreach($db->query("SELECT * FROM customers WHERE id = '$id'") as $row) { echo $row{contact"}; }
  19. How to filter and show data in search without using submit button..because thats the only function i need to finish my code..can anyone help me? I dont want to use submit button cause it refreshes the page...I have the code for search already I need a function that after I search the data will show in the textboxes without using submit button. php code: <?php if($_GET){ include('include/connect.php'); $batchcode = $_GET['code']; $sql = mysql_query("SELECT aic,batchcode,address,name FROM tb_app WHERE batchcode = '".$batchcode."' "); if($sql) { while($rows = mysql_fetch_array($sql)){ $aic[] = $rows['aic']; $name[] = $rows['name']; $address[] = $rows['address']; } } }else{ $aic = array(NULL,NULL,NULL,NULL); $name = array(NULL,NULL,NULL,NULL); $address = array(NULL,NULL,NULL,NULL); } ?> html code: <html> <head> <title>test</title> </head> <body> <form action="" method="get"> Search Batchcode:<input type="text" name="code" id="query" /><br /> <table> <tr> <td> aic: <br /> <input type="text" name="optA1" value="<?php if(empty($aic[0])){$aic[0] = array(NULL);}else{echo $aic[0];} ?>" /> <br /> <input type="text" name="optA2" value="<?php if(empty($aic[1])){$aic[1] = array(NULL);}else{echo $aic[1];} ?>" /> <br /> <input type="text" name="optA3" value="<?php if(empty($aic[2])){$aic[2] = array(NULL);}else{echo $aic[2];} ?>" /> <br /> <input type="text" name="optA4" value="<?php if(empty($aic[3])){$aic[3] = array(NULL);}else{echo $aic[3];} ?>" /> <br /> </td> <td> Name List: <br /> <input type="text" name="optB1" value="<?php if(empty($name[0])){$name[0] = array(NULL);}else{echo $name[0];} ?>" /> <br /> <input type="text" name="optB2" value="<?php if(empty($name[1])){$name[1] = array(NULL);}else{echo $name[1];} ?>" /> <br /> <input type="text" name="optB3" value="<?php if(empty($name[2])){$name[2] = array(NULL);}else{echo $name[2];} ?>" /> <br /> <input type="text" name="optB4" value="<?php if(empty($name[3])){$name[3] = array(NULL);}else{echo $name[3];} ?>" /> <br /> </td> <td> Address: <br /> <input type="text" name="optC1" value="<?php if(empty($address[0])){$address[0] = array(NULL);}else{echo $address[0];} ?>" /> <br /> <input type="text" name="optC2" value="<?php if(empty($address[1])){$address[1] = array(NULL);}else{echo $address[1];} ?>" /> <br /> <input type="text" name="optC3" value="<?php if(empty($address[2])){$address[2] = array(NULL);}else{echo $address[2];} ?>" /> <br /> <input type="text" name="optC4" value="<?php if(empty($address[3])){$address[3] = array(NULL);}else{echo $address[3];} ?>" /> <br /> </td> </form> </body> </html> script code: <!--search function code--> <script type="text/javascript"> $(document).ready(function(){ $("#query").autocomplete({ source : 'search.php', select : function(event,ui){ $("#query").html(ui.item.value); } }); }); </script> search.php page code: <?php $q = $_GET['term']; mysql_connect("localhost","root",""); mysql_select_db("test"); $query = mysql_query("SELECT DISTINCT batchcode FROM tb_app WHERE batchcode LIKE '$q%'"); $data = array(); while($row = mysql_fetch_array($query)){ $data[]=array('value'=>$row['batchcode']); } echo json_encode($data); ?>
  20. i dont want to use "str_repeat". could someone give me some ideas how to make my own function without using str_repeat i am wanting the user to enter 4 numbers into 4 input boxes for example input 1 : 6 input 2 : 5 input 3 : 4 input 4 : 3 answer 666666 55555 4444 333
  21. I need to pass a variable from html through ajax to php The following code is what I have contacttext is what fells in the data from ajax <select name="contact"type="text" class="form-control input-sm contacttext" id="idcontact"></select> $( document ).ready(function() { $.ajax({ //create an ajax request to load_page.php type: "GET", url: "php/contact.php", dataType: "html", //expect html to be returned success: function(response){ $(".contacttext").html(response); //alert(response); } }); }); $id is what I need to pass threw the ajax script <?php include("connect.php"); $pid = $_SESSION['profile']['id']; echo "<option value=''>SELECT A CONTACT</option>"; foreach($db->query("SELECT * FROM contact WHERE pid = '$pid' AND cid = '$id'") as $row) { echo "<option value=" . $row['cid'] . ">" .$row['contact'] . "</option>"; }
  22. hello there people does any one know how to store a group of variables inside 1 variable. so if i had ($1, $2, $3, $4 ........) i am wanting to store them in 1 variable like so $list
  23. Hello i would require help with the given script AJAX Code (text): $.ajax({ type: "post", url: "http://localhost/raffle.php", dataType: "json", data: { "postraffle": "true", "title": $("#rtitle").val(), "message": $("#mess").val(), "maxentry": $("#maxentry").val(), "duration": $("#durr").val(), "filter": $("#reffil").val(), "split": $("input[name=split]:checked").val(), "pub": $("input[name=rafflepub]:checked").val(), "stype": $("input[name=stype]:checked").val(), "invo": $("input[name=invo]:checked").val(), "items[]": itms, "games[]": gmes, }, success: function(data){ if(data.status == "fail") { alert(data.message); $("#rafBut").removeAttr("disabled"); $("#rafBut").attr("value", "Raffle it!"); } else if(data.status == "ok") { window.location.href = "http://localhost/raffle.php"; } } }); </script> And here is the php script PHP: <?php $data = array( 'status' => 'fail', 'message' => 'Failed to save data', ); echo json_encode($data); You can see the script live here admin.tftrg.com/Prototype/raffle.html I want all of the above data to transmit from HTML using ajax to php i would like to echo all the information from the ajax script to the php script Well currently it shows an error FAILED TO TRANSMIT DATA Some help would be really appreciated Thanks!
  24. I have a table called tb_app with fields 'id','aic','batchcode','name' example table value: '1','0001','1','james'. As you can see there are three textboxes(name)(aic)(batchode). I want to show the value of aic and batchcode in their correspoding textboxes after typing the specific name in the textbox(name). The problem is when you type james in the textbox(name) it shows '00011' in the (aic)textbox and (batchcode)textbox...i want it to be '0001' in aic and '1' in the batchcode if i type james which is stored value in the table. html code: <form method="post"> <input type="text" name="names" id="query" onblur="getvalues()"/> <input type="text" name="aic" id="aic"/> <input type="text" name="batchcode" id="batchcode" /> </form> script code: <script type="text/javascript"> function getvalues() { var selname = $("input[name=names]:text").val(); $.ajax({ url: "getuserdata.php", data: {"selname":selname}, type: 'post', success: function(output) { $("#aic").val(output); $("#batchcode").val(output); } }); } </script> getuserdata.php page: <?php include('include/connect.php'); $selname = $_POST['selname']; $query = "SELECT * FROM tb_app WHERE tb_app.name RLIKE '$selname'"; $result = mysql_query($query) or die(mysql_error()); while($rows = mysql_fetch_array($result)){ echo $rows['aic']; echo $rows['batchcode']; } ?>
  25. hello guys just a quick question i have made a html form with php embedded. here is php code: how could i change the code if 1 of the inputs is'nt numeric then it would echo a message saying "insert numeric values" at the minute it echos that if all numeric values are entered. elseif(is_numeric($_POST['number1']) && is_numeric($_POST['number2']) && is_numeric($_POST['number3']) && is_numeric($_POST['number4'])){ echo "please insert number";
×
×
  • 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.