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. I have a php registration Script with a php form validation. The Validation seems to be working fine But it is independent of mysql insert query so wether the form input is correct or not the data will still be sink into the data base. <!DOCTYPE html> <html lang="en"> <head> <meta content="en-us" http-equiv="Content-Language"> <link rel="stylesheet" href="style.css" type="text/css" media="all"> <title> Register Page </title> </head> <body> <div id="wrapper"> <!--header--> <?php include("include/header.php"); ?> <!-- end header--> <!-- nav--> <?php include("include/nav.php"); ?> <!-- end nav--> <!-- left bar--> <?php include("include/left_bar.php"); ?> <!-- end left bar--> <!-- content--> <div id="content" align="left"> <form method="post" action="check_register.php"> First Name: <br><input type="text" name="fname" ><br> <?php if (isset($_POST["submit"])&&(empty($fname))) { echo"<center><em><div id='form'>Please Your Frist Name Is Required<br></div></em></center>";}?> Last Name: <br><input type="text" name="lname" ><br> <?php if (isset($_POST["submit"])&&(empty($lname))) { echo"<center><em><div id='form'>Please Your Last Name Is Required<br></div></em></center>";}?> User Name: <br><input type="text" name="username" ><br> <?php if (isset($_POST["submit"])&&(empty($username))) { echo"<center><em><div id='form'>Please Your User Name Is Required<br></div></em></center>";}?> Email:<br> <input type="email" name="email" ><br> <?php if (isset($_POST["submit"])&&(empty($email))) { echo"<center><em><div id='form'>Please Your Email Is Required<br></div></em></center>";}?> Password: <br><input type="Password" name="password" ><br> <?php if (isset($_POST["submit"])&&(empty($password))) { echo"<center><em><div id='form'>Please a Password Is Required<br></div></em></center>";}?> Phone: <br><input type="tel" name="phone" ><br> <?php if (isset($_POST["submit"])&&(empty($phone))) { echo"<center><em><div id='form'>Please Your Number Is Required<br></div></em></center>";}?> Gender: <br><input type="text" name="gender" ><br> <?php if (isset($_POST["submit"])&&(empty($gender))) { echo"<center><em><div id='form'>Please Your Gender Is Required<br></div></em></center>";}?> <input type="submit" name="submit" value="Register"> </form> </div> <!-- end content--> <!-- right bar--> <?php include("include/right_bar.php"); ?> <!-- end right bar--> <!-- footer--> <?php include("include/footer.php"); ?> </div> <!-- end footer--> </body> </html> that is my register.php that contain the php form validation. Here is check_register that contains the mysql query Someone Please Use master eye and Spot the Problem for me <?php $host="localhost"; $dbuser="root"; $dbpass=""; $db_name="login"; $db_table="login"; mysql_connect("$host","$dbuser","$dbpass") or die("Could Not Establish Connection"); mysql_select_db("$db_name")or die(mysql_error()); $fname=$_POST["fname"]; $lname=$_POST["lname"]; $username=$_POST["username"]; $email=$_POST["email"]; $password=$_POST["password"]; $phone=$_POST["phone"]; $gender=$_POST["gender"]; //validation of input in the form fieldS include("register.php"); $submit=mysql_query("INSERT INTO users(fname,lname,username,email,password,phone,gender)VALUES('$fname','$lname','$username','$email','$password','$phone','$gender')") or die("REGISTRATION NOT COMPLETED Thanks"); if($submit==TRUE){ Echo"<div style='background:yellow;'><script>alert('YOU HAVE SUCESSFULLY REGISTERED PLEASE LOGIN WITH YOUR USERNAME AND PASSWORD');</script></div>"; } ?>
  2. I want to create a real esatte website. This is part of my code. The user selects a category.Then ajaxhelp is called and sends the cariable category to ajax.php. There it gets the type of estate wuering the database. however i want to enable the selected="selected" option, in order in category php in id=category in the bottom to print the option the user has already selected. i don't know how to it. The selected option doesnt work <script> function ajaxhelp(str) { if (str=="") { document.getElementById("category").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("category").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","prosthiki_akinitou_form_ajax.php?category="+str,true); xmlhttp.send(); } </sqript> //category.php <tr > <td><h4>Category:<small class="red">*</small></h4></td> <td ><select name="category" onChange="ajaxhelp(this.value);"> <?php $category_array = get_categories(); //estate_fns echo '<option value=""><h4>- Choose Estate Category -</h4></option>'; foreach ($category_array as $row) { if($estate_array['catid'] === $row['catid']) { echo '<option selected="selected" value="'. $row['catid'].'"><h4>' . $row['catname'].'</h4></option>'; } else { echo '<option value="'. $row['catid'].'"><h4>' . $row['catname'].'</h4></option>';} } ?> </select> </td></tr> <?php echo '<tr >'; echo '<td><h4>Estate type:</h4></td> <td ><select name="eidos" id="category" >'; echo '</select> </td></tr>'; ?> //ajax.php include ('estate_sc_fns.php'); $katigoria = $_GET['category']; //get the value from ajax.php $estate_array = get_estate_details($_SESSION['estate_code']); //get the estate type the user already has entered from mysql $eidos_array = get_estate_type($category); //get all possible estate types from mysql foreach ($eidos_array as $row) { if($estate_array['estate_type'] === $row['estate_type'] ) { echo '<option selected="selected" value="'. $row['estate_type'].'"><h4>' . $row['estate_name'].'</h4></option>'; } else { echo '<option value="'. $row['estate_type'].'"><h4>' . $row['estate_name'].'</h4></option>';} } But the selected="selected" doesn't work! Please help how to do it?
  3. Hi. I don't know how to have the code </textarea> INSIDE of a textarea using PHP. $edit_content_de = "<textarea>Text</textarea>asd"; <p><?php echo '<textarea name="content" id="codeTextarea" style="width:90%; height:500px;">'. $edit_content_de; .'</textarea>'; ?></p> But obviously what happens is the textarea ends and BELOW the textarea it says "asd". How do I stop this and have it say </textarea> INSIDE textarea instead of closing it?
  4. Hallo. I have a form <form id="form2" method="post" action="insert_data.php>"> <select name="catid" id="catid" onChange="showkatigoria(this.value);"> <option value="'. $row['catid'].'"><h4>' . $row['catname'].'</option> // something i need with php, i dont' think it matters <option value="'. $row['catid'].'"><h4>' . $row['catname'].'</option> <option value="'. $row['catid'].'"><h4>' . $row['catname'].'</option> //option value bla bla bla bla i have 4-5 options value. </select> My javascript: <script type="type/javascript"> function showkatigoria(str) { if (str=="") { document.getElementById("catid").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("catid").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","insert_data.php?category="+str,true); xmlhttp.send(); } </script> It doesn't work what ever i do. Please help! I don't know javascript, let alone ajax. It's urgent. Please help!
  5. I have a form, it's reading the mysql database. I have a while loop to display all of the fields in the table so you can edit it. Yes, it displays the fields, but I'm having problems with the update part, when I specify the ID (which is a hidden field) it takes the last field in the form and uses that to update. For example: UPDATE mitigations SET `status`='Watch', `notes`='test6' WHERE id='6';UPDATE mitigations SET `status`='Watch', `notes`='test6' WHERE id='6';UPDATE mitigations SET `status`='Watch', `notes`='test6' WHERE id='6';UPDATE mitigations SET `status`='Watch', `notes`='test6' WHERE id='6';UPDATE mitigations SET `status`='Watch', `notes`='test6' WHERE id='6';UPDATE mitigations SET `status`='Watch', `notes`='test6' WHERE id='6'; I need id to actually get the ID from the form where it's a hidden field. It works now, but only for the last field. Make sense? Here's the actual code I have on the edit form itself: <?php while ($data = mysql_fetch_array($mitigation_query)) {echo "<form><tr><td width='56' height='20px'><input type=hidden name='mitigation_id' value=". $data['id'] ."><span id='MitigationOnTrack'><input type='text' name='mitigation_status' value=". $data['status'] ."></span></td><td width='758'><input type=text name='mitigation_id' value=". $data['id'] ."><textarea rows=5 cols=100 name='mitigation_notes'>" . $data['notes'] ."</textarea></td></tr></form>"; } ?>
  6. I've been combing forums for 2 weeks now trying to find a way to have a working contact form on my portfolio site. I couldn't have fathomed how difficult this task is turning out to be. I'm a competent HTML and CSS developer. PHP, however, is new to me. I've been studying up on it at treehouse and understand the basic $_POST, echo, and !isset commands. My site is live at http://kovcreation.com/ I'm not married to the contact form that's on there but i understand it entirely. I'm just so frustrated after trying many different solutions I just want it to work !!! Any help is greatly appreciated Form HTML <div class="contact_form"> <div class="touch"> </div> <form id="contact_me_form" method="post" action="email.php"> <div class="error_contact" id="name_error">Name is Required</div> <input type="text" placeholder="Your Name (required)" id="name" class="textbox" /> <input type="text" name="email" id="email" placeholder="Your Email (required)" class="textbox email"> <div class="error_contact" id="comment_error">Message is Required</div> <textarea cols="25" rows="5" name="message" id="comment" class="textbox message" placeholder="Your Message ( Inquiry? , Freelance Work? , or Just to Say Hi...)"></textarea> <input type="image" src="img/send.png" alt="Send Message" name="submit" class="button submit_btn"> </form> </div> email php <?php if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "michael@kovcreation.com"; $email_subject = "Contact from portfolio site"; 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['message'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['name']; // required $email_from = $_POST['email']; // required $message = $_POST['message']; // 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 First Name you entered does not appear to be valid.<br />'; } } if(strlen($message) < 2) { $error_message .= 'The message 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 .= "Message: ".clean_string($message)."\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); ?> <p>Thank you for contacting us. We will be in touch with you very soon.</p> <?php } ?> Thanks for reading email.php index.html style.css
  7. Dear , I am need of some thing with the help of which i would be able to generate dynamic/variable documents for my business use. I need a data input page where one can feed all data at one place & later on same data came be parsed to various pre formated documents. As per my need, i have to write several documents related to single business deal. I have to fill up same details in all those documents. So, my idea is fill up all such information at one place then later on, the same data can be passed on to all related documents for printing purpose. You can create one data entry module (like forms etc.) to collect relevant data then create another module in which i can link different documents format in which data can be lifted from the collected information. I requires to create something which can hold input variables then you have to retrieve all those variable in documents. I am attaching 3 files in order to understand you better my project. These 3 files are having data sample, sample document & finished document. link of document ; http://goo.gl/fVKBmv project.zip
  8. I have this bellow code its a jquery to add form elements dynamically. my question is when Im submiting the form to the database it only send first set of elements value only, rest are not sending to the database, plz help me on this.. here is my codes. jquery- <script type="text/Javascript"> $(document).ready(function() { $('#btnAdd').click(function() { var num = $('.clonedSection').length; var newNum = new Number(num + 1); var newSection = $('#pq_entry_' + num).clone().attr('id', 'pq_entry_' + newNum); newSection.children(':first').children(':first').attr('id', 'contNo_' + newNum).attr('name', 'contNo_' + newNum); newSection.children(':nth-child(2)').children(':first').attr('id', 'contNo2_' + newNum).attr('name', 'contNo2_' + newNum); newSection.children(':nth-child(3)').children(':first').attr('id', 'contNo3_' + newNum).attr('name', 'contNo3_' + newNum); newSection.children(':nth-child(4)').children(':first').attr('id', 'contNo4_' + newNum).attr('name', 'contNo4_' + newNum); newSection.children(':nth-child(5)').children(':first').attr('id', 'contNo5_' + newNum).attr('name', 'contNo5_' + newNum); newSection.children(':nth-child(6)').children(':first').attr('id', 'contNo6_' + newNum).attr('name', 'contNo6_' + newNum); newSection.insertAfter('#pq_entry_' + num).last(); $('#btnDel').prop('disabled',''); if (newNum == 5) $('#btnAdd').prop('disabled','disabled'); }); $('#btnDel').click(function() { var num = $('.clonedSection').length; // how many "duplicatable" input fields we currently have $('#pq_entry_' + num).remove(); // remove the last element // enable the "add" button $('#btnAdd').prop('disabled',''); // if only one element remains, disable the "remove" button if (num-1 == 1) $('#btnDel').prop('disabled','disabled'); }); $('#btnDel').prop('disabled','disabled'); }); //$('#blinfo').on('submit', function (e) { //prevent the default submithandling // e.preventDefault(); //send the data of 'this' (the matched form) to yourURL // $.post('bladd.php', $(this).serialize()); //}); </script> Here is the HTML (both codes are in the same file) <ul id="pq_entry_1" class="clonedSection"> <li><input type="text" name="contNo_1" id="contNo_1" size="45" value=""/></li> <li>SIZE<input type="text" name="contNo2_1" id="contNo2_1" size="15" value=""/></li> <li>MODE<input type="text" name="contNo3_1" id="contNo3_1" size="15" value=""/></li> <li>PICES<input type="text" name="contNo4_1" id="contNo4_1" size="15" value=""/></li> <li>WEIGHT<input type="text" name="contNo5_1" id="contNo5_1" size="15" value=""/></li> <li>VOLUME<input type="text" name="contNo6_1" id="contNo6_1" size="15" value=""/></li> </ul> <input type='button' id='btnAdd' size="15" value='add another row' /><input type='button' id='btnDel' value='delete row' /> and here is my sql query <?php $con=mysqli_connect("localhost","root","1234","shipping"); // Check connection if (mysqli_connect_errno()) { mysqli_connect_error(); } $sql="INSERT INTO infobl (contNo_1, contNo2_1, contNo3_1, contNo4_1, contNo5_1, contNo6_1, contNo_2, contNo2_2, contNo3_2, contNo4_2, contNo5_2, contNo6_2, datetime) VALUES ('$_POST[contNo_1]','$_POST[contNo2_1]','$_POST[contNo3_1]','$_POST[contNo4_1]','$_POST[contNo5_1]','$_POST[contNo6_1]','$_POST[contNo_2]','$_POST[contNo2_2]','$_POST[contNo3_2]','$_POST[contNo4_2]','$_POST[contNo5_2]','$_POST[contNo6_2]',NOW())"; if (!mysqli_query($con,$sql)) { die('<font color="#FF0000"><h2>Error: ---PLEASE CHECK YOUR NUMBER AGAIN....<br />Press Back on the browser.... </h2></font>' . mysqli_error($con)) ; } else header('location: /bldrft/edits/view.php'); mysqli_close($con); ?> I can't figure it out what was the wrong, all are fine to me, plzz help guys. thanks.
  9. HALLO, i have one major problem. I have a page that submits data to another with post for example this: <form id="form2" method="post" action="articles.php" > <table id="table1" class="adminformat" > <tr><td> <br></br><td></tr> <tr > <td><strong>Category:</strong></td> <td class="spaceUnder"><select name="catid" > <?php $cat_array = get_categories(); foreach ($cat_array as $row) { echo '<option value="'. $row['catid'].'">' . $row['catname'].'</option>'; } ?> </select> </td></tr> <tr> <td colspan="2"><strong>Title :</strong> </td></tr> <tr> <td colspan="2" class="spaceUnder"><input maxlength="300" class="inputglow" type="text" name="title"/></td></tr> <tr> <td colspan="2"><strong>Message :</strong> </td></tr> <tr> <td colspan="2"><textarea name="message"> </textarea></td></tr> <td align="right" colspan="2"> <input type="reset" class="button" value="Clear"/> <input type="submit" class="button" value="OK"/></td></tr> </table> </form> The data is send to articles.php. If user presses refresh or back button, an ERROR PAGE in the browser is shown or forms are empty. I know i have to store somehow my variables. I have many forms, so i am looking for the best an easyest way, because i have to fill in a lot of code in many pages. Furthermore when i press back and forawrd again, the articles page cannot be shown. Instead teh browser shows a message that the page HAS EXPIRED! I am so freaked out. Please help i am so stuch.URGENT!!!!!!!!!
  10. I'm working on a WordPress website. This is in the child's function.php file. I'm just wondering if I need to sanitize when I embed strings within HTML markup. if (is_user_logged_in()) { $user = wp_get_current_user(); $fName = $user -> user_firstname; $lName = $user -> user_lastname; $items .= '<li id="user-name" title="Edit my profile" ><a href="' . site_url('/something') . '">' . $fName . ' ' . $lName . '</a></li>'; $link = '<a href="' . wp_logout_url($redirect) . '" title="' . __('Logout') . '">' . __('Logout') . '</a>'; } Do I need to sanitize $items and $link? If so, would it be this? $items .= '<li id="user-name" title="Edit my profile" >htmlspecialchars(<a href="' . site_url('/something') . '">, ENT_QUOTES)' . $firstName . ' ' . $lastName . '</a></li>'; $link = htmlspecialchars('<a href="' . wp_logout_url($redirect) . '" title="' . __('Logout') . '">' . __('Logout') . '</a>, ENT_QUOTES)'; How about this one? echo '<p>' . __('A message will be sent to your email address.') . '</p>'; to echo '<p>' . htmlspecialchars(__('A message will be sent to your email address.'), ENT_QUOTES) . '</p>'; Thanks for helping.
  11. Hi, I'm not sure if either I just have had a stupid error or what. Here is my code on the page with the functions for my script, which is called using require_once() on my other page. session_start(); function log_in($username, $password) { global $ss_con; $_SESSION['logged_in'] = 'true'; $_SESSION['username'] = $username; } This is the code for the other page that has require once... require_once('firstpage.php'); log_in(); if ($_SESSION['logged_in'] != 'true') { echo $_SESSION['logged_in']; echo 'fail!'; } The responce I get is "fail!" Don't worry about log_in() being set. I did that on another page on the same host that just forwards to this. Please help me!
  12. hello i got a problem with ajax-php that is including html file, javascript external file, php external file. now i got a problem give a value to button,button2,button3 when the php write the html code, but if the javascript or it wrote in the html file already the javascript is working fine, also jquery isn't working as well if the php create the html (div, textarea, input and br) code. what is the problem with the ajax-php version and why functions button_onload() and disabled_div_textarea_text2() not working well? first version-ajax-php version: (function button_onload() and function disabled_div_textarea_text2() isn't working in this version) here is the code of the html file: <!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" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Language" content="he" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="index.js"></script> <link rel="stylesheet" href="index.css" /> <!--<script src="jquery-2.0.3.min.js"></script>--> <title>textbox changing with ajax - php - version 1</title> <!-- javascript code --> <script language="JavaScript"> </script> </head> <body id='body'> <div id='div_textarea'></div> </body> </html> here is the code of the JavaScript file: try { /* ajax-php */ function ajax_php() { var str = new String; str = '1'; //alert('str2'); if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } //alert('str3'); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById('div_textarea').innerHTML = xmlhttp.responseText; //document.getElementById('div_textarea').value = xmlhttp.responseText; //alert(xmlhttp.responseText); } } //alert('str4'); xmlhttp.open("POST","index.php?str=" + str, true); xmlhttp.send(); } /* fffff */ onload = function() { ajax_php(); /* load fuinctions */ /* --------------- */ button_onload(); clear_textarea1_2(); disabled_div_textarea_text2(); } /* fffff */ function button_onload() { /* first version */ /* ------------- */ document.getElementById('button').innerHTML = 'button 1'; document.getElementById('button2').value = 'button 2'; document.getElementById('button3').value = 'clear/clean'; } /* fffff */ function button() { /* show what the textarea inside text */ //alert(document.getElementById('div_textarea_text').value); document.getElementById('div_textarea_text2').value = document.getElementById('div_textarea_text').value; } /* fffff */ function button2() { /* show what the textarea inside text */ //alert(document.getElementById('div_textarea_text').value); document.getElementById('div_textarea_text2').value = document.getElementById('div_textarea_text').value; } /* textarea functions */ /* ------------------ */ /* fffff */ function clear_textarea1_2() { clear_div_textarea_text(); clear_div_textarea_text2(); } /* fffff */ function clear_div_textarea_text() { document.getElementById('div_textarea_text').value = ''; } /* fffff */ function clear_div_textarea_text2() { document.getElementById('div_textarea_text2').value = ''; } /* fffff */ function disabled_div_textarea_text2() { document.getElementById('div_textarea_text2').disabled = true; document.getElementById('div_textarea_text3').readOnly = true; } } catch(err) { txt='There was an error on this page.\n\n'; txt+='Error description: ' + err.message + '\n\n'; txt+='Click OK to continue.\n\n'; alert(txt); } here is the php code file: <?php $str1 = '<br />'; $str2 = '<textarea id="div_textarea_text"></textarea>'; $str3 = '<div id="button" onclick="button();"></div>'; $str4 = '<input type="button" onclick="button2();" id="button2" value="" />'; $str5 = '<textarea id="div_textarea_text2"></textarea>'; $str6 = '<input type="button" onclick="clear_textarea1_2();" id="button3" />'; $str7 = '<textarea id="div_textarea_text3"></textarea>'; echo($str1 . $str2 . $str1 . $str3 . $str1 . $str4 . $str1 . $str5 . $str1 . $str6 . $str1 . $str7); ?> but now take a look at this second version- php file with JavaScript: (php file and JavaScript file and working fine.) the php file code: <!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" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Language" content="he" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="index.js"></script> <link rel="stylesheet" href="index.css" /> <script src="jquery-2.0.3.min.js"></script> <title>textbox changing with php - version 2</title> <!-- javascript code --> <script language="JavaScript"> </script> </head> <body id='body'> <div id='div_textarea'> <?php $str1 = '<br />'; $str2 = '<textarea id="div_textarea_text"></textarea>'; $str3 = '<div id="button" onclick="button();"></div>'; $str4 = '<input type="button" onclick="button2();" id="button2" value="" />'; $str5 = '<textarea id="div_textarea_text2"></textarea>'; $str6 = '<input type="button" onclick="clear_textarea1_2();" id="button3" />'; $str7 = '<textarea id="div_textarea_text3"></textarea>'; echo($str1 . $str2 . $str1 . $str3 . $str1 . $str4 . $str1 . $str5 . $str1 . $str6 . $str1 . $str7); ?> </div> </body> </html> JavaScript file code: try { /* fffff */ onload = function() { /* load fuinctions */ /* --------------- */ button_onload(); clear_textarea1_2(); disabled_div_textarea_text2(); } /* fffff */ function button_onload() { /* first version */ /* ------------- */ document.getElementById('button').innerHTML = 'button 1'; document.getElementById('button2').value = 'button 2'; document.getElementById('button3').value = 'clear/clean'; } /* fffff */ function button() { /* show what the textarea inside text */ //alert(document.getElementById('div_textarea_text').value); document.getElementById('div_textarea_text2').value = document.getElementById('div_textarea_text').value; } /* fffff */ function button2() { /* show what the textarea inside text */ //alert(document.getElementById('div_textarea_text').value); document.getElementById('div_textarea_text2').value = document.getElementById('div_textarea_text').value; } /* textarea functions */ /* ------------------ */ /* fffff */ function clear_textarea1_2() { clear_div_textarea_text(); clear_div_textarea_text2(); } /* fffff */ function clear_div_textarea_text() { document.getElementById('div_textarea_text').value = ''; } /* fffff */ function clear_div_textarea_text2() { document.getElementById('div_textarea_text2').value = ''; } /* fffff */ function disabled_div_textarea_text2() { document.getElementById('div_textarea_text2').disabled = true; document.getElementById('div_textarea_text3').readOnly = true; } } catch(err) { txt='There was an error on this page.\n\n'; txt+='Error description: ' + err.message + '\n\n'; txt+='Click OK to continue.\n\n'; alert(txt); }
  13. Hi can someone help me out as i'm new to php. I have a grabber built in to my script that gets info from other sites for example. This part is from the site that my grabber gets the info from. <div class="txt-block"> <h4 class="inline">Runtime:</h4> <time itemprop="duration" datetime="PT103M">103 min</time> </div> And this is how my grabber gets this info from the site. $times = $dom->getElementsByTagName('time'); for($i=0; $i<$times->length; $i++){ $itemprop = $times->item($i)->getAttribute("itemprop"); if ($itemprop == "duration"){ if ($times->item($i)->textContent!='-'){ $res['duration'] = $times->item($i)->textContent; } } } Now what i'm stuck on is what would the code be to get the date published from the site. <span class="nobr"> <a href="/title/tt0099785/releaseinfo?ref_=tt_ov_inf " title="See all release dates"> 16 November 1990 <meta itemprop="datePublished" content="1990-11-16"> (USA) </a> </span> Would it be something like this. $meta = $dom->getElementsByTagName('meta'); for($i=0; $i<$meta->length; $i++){ $itemprop = $meta->item($i)->getAttribute("itemprop"); if ($itemprop == "datePublished"){ if ($meta->item($i)->textContent!='-'){ $res['datePublished'] = $meta->item($i)->textContent; } } } Could someone please help as i don't have a clue about writing php.
  14. <?php $user="root"; $password=""; $database="base"; $host="localhost"; $table="com"; mysql_connect($host, $user, $password) or die("error"); mysql_select_db($database) or die("error"); $name = $_POST['name']; $lastname = $_POST['lastname']; $email = $_POST['email']; $coment= $_POST['coment']; $error = ''; if(empty($name) || empty($lastname) || empty($email) || empty($coment)) { $error .= 'error. '; } if(!preg_match("/^[a-zA-A]+$/i", $name)) { $error .= 'Error '; } if(!preg_match("/^[a-zA-A]+$/i", $lastname)) { $error .= 'Error '; } if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email)) { $error .= 'errorl. '; } if(!preg_match("/^[a-zA-z0-9.,?!]+$/i", $comment)) { $error .= 'Error '; } if($error == '') { $result = "INSERT INTO com (name, lastname, email, coment) VALUES('$name', '$lastname', '$email','$coment')"; echo "<script type='text/javascript'>alert('Thanks.'); window.close();</script>";} else{ echo"<script type='text/javascript'>alert ('$error'); window.close(); </script>";} Errors seems to be working its just it won't insert data in table in mysql database.... Thank you so much.
  15. Hey, Xyphon here. I have known PHP now for over 5 years and I have been freelancing on and off for about 3. I've created many websites and am capable of doing nearly anything that PHP can do. I am experienced with MySQL and databases as well. I'm not much of a "designer" but I can design your website if you'd like as well. I also have some basic knowledge in JavaScript and jquery. I work for fairly cheap comparatively speaking and am pretty flexible as well. If you need to contact me either shoot me a pm or email me at dbgt525@gmail.com Thanks.
  16. I need to create columns in my html with some comments that are being pulled from my database and posted via ajax. This is what I need it to look like after the PHP does its thing. <div class="container"> <div class="comment"></div> <div class="comment"></div> </div class="comment"></div> </div> right now it doesn't create the container causing me to have layout issues. How would you have PHP wrap a container around every third div? I'm very much a front end developer and can't seem to wrap my head around this one. Thanks for the help!
  17. I have a dynamic php page that has a series of select boxes at the top. When the user changes what is in the select boxes a div at the bottom of the page gets populated with a table via an ajax call to a php script. I am need of a button on that page that a user can click that will give them the option to save that displayed table as a .csv file. I have been looking all over for a solution that will work in both ie and ff, and am not coming up with anything. Any help would be great. Thanks!
  18. Hi Folks, Netbiz Group have 2 vacancies within the development department - Front End Developer and PHP Developer. Netbiz Group are a leading provider of website design, development and Internet Marketing, based in Newcastle Under Lyme, Staffordshire. We are not interested in outsourcing or using freelancers as this is an internal post based in our offices. Please can you send me your CV with examples of your work. Great packages available to the right candidates! Regards Susan 0845 456 7617 susan@netbizweb.co.uk
  19. Hello so I'm trying to make my own simple forum. How would can I do a quick quote/ reply to comment. Something WordPress would normally do with the #respond. I've done my own code and I can't seem to insert the code into a hidden input so that the users can't see the HTML codes that are outputted in the reply string. Generally, my code works fine and all, it's just that when someone clicks the "Quote" link, it literally inserts the actual HTML outputs into the textarea. I want something like WordPress' #respond command so that when someone hits the "Quote" link, it'll still quote the actual content the user is trying to respond to, but it'll also not output the HTML codes into the textarea. Here is my PHP code: <?php $reply = '<div style=\"border: 1px dashed\"><span style=\"text-transform: uppercase; font-family: Oswald, Arial, Helvetica, sans-serif; font-size: 16px; font-weight: 300; margin: 0px 10px 0px 0px; width: 100%; color: #00A6EB;\">' . $row['username'] . '</span><p>' . $row['message'] . '</p></div><br /><br />'; ?> Here is my HTML code: <a href="#" onclick='insertext("<? echo $reply; ?>"); return false;'>Quote</a> Here is my Javascript code: <script type="text/javascript"> function insertext(text) { document.formname.messages.value += text + " "; document.formname.messages.focus(); } </script>
  20. I have yet another error guys,im currently working on an hotel App i'm almost done so i'm doing some debugging. I have a page where the hotel administrator can edit gallery, now when i was done editing i clicked save, it actually updated and stored it into the database but it displayed the error below in the text field <br /> <font size='1'><table class='xdebug-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'> <tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Notice: Uninitialized string offset: 0 in C:\wamp\www\hot\apps\admin-edit-gallery.php on line <i>53</i></th></tr> <tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr> <tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr> <tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0038</td><td bgcolor='#eeeeec' align='right'>391904</td><td bgcolor='#eeeeec'>{main}( )</td><td title='C:\wamp\www\hot\apps\admin-edit-gallery.php' bgcolor='#eeeeec'>..\admin-edit-gallery.php<b>:</b>0</td></tr> </table></font> Do you guys know what could have gone wrong? Cheers everyone!
  21. Right now these are my tables.. i have create a page that list all the users and there is an edit button.. My question is when i click the edit button, how to view the name of the user and a select box option where the options are my course and subject that been stored? Then, when i fill the course and subject from the select box, it will stored to user_subject and user_course table.. <?php session_start(); require_once('function.php'); //Set this to what ever page you include that holds all your functions so that we can use the checkUserStatus() checkUserStatus('admin'); ?> <html> <head> <title> View Users </title> </head> <body> <h2 align='right'><a href='admin.php'>Home</a></h2> <center><h2>Users Information</h2><center> <table width='800' align='center' border='5'> <tr bgcolor='yellow'> <th>No.</th> <th>Full Name</th> <th>Matrix No.</th> <th>Username</th> <th>Password</th> <th>User Type</th> <th>Edit User</th> <th>Delete User</th> </tr> <?php mysql_connect("localhost","root",""); mysql_select_db("class_attendance"); $query = "select * from user"; $run = mysql_query($query); while ($row=mysql_fetch_array($run)){ $id = $row[0]; $full_name = $row[1]; $matrix_no = $row[2]; $username = $row[3]; $pass = $row[4]; $type = $row[5]; ?> <tr align='center'> <td><?php echo $id; ?></td> <td><?php echo $full_name; ?></td> <td><?php echo $matrix_no; ?></td> <td><?php echo $username; ?></td> <td><?php echo $pass; ?></td> <td><?php echo $type; ?></td> <td><a href='edit.php?del=<?php echo $id;?>'>Edit</a></td> <td><a href='delete.php?del=<?php echo $id;?>'>Delete</a></td> </tr> <?php } ?> </table> </body> </html>
  22. Im now making a simple project called student attendance.. I've just managed the register/login part.. Right now, these are the tables that i created so far.. http://i272.photobucket.com/albums/jj178/r1nk_2008/1_zpsf1765f1c.png http://i272.photobucket.com/albums/jj178/r1nk_2008/2_zpsa1a1310a.png http://i272.photobucket.com/albums/jj178/r1nk_2008/3_zps092b7ff1.png http://i272.photobucket.com/albums/jj178/r1nk_2008/4_zps1fffbc49.png What i need right now is some advice on how :- The lecturer can select the course_id that have been assigned and then list of subject he/she teach will appear.. Based on what subject he/she clicked, an attendance table appear with list of students in that class and week 1- week XX (checkbox for attendance).. Do i need to assign some primary and foreign key in my tables or adding some more necessary tables?
  23. Hello! I have made a query and displaying this - it's working. But I want this query-result to be a link (href) to another query that I want to display. My query right now is: <ul> <?php $test = mysql_query("SELECT * FROM `huvudProject` WHERE `categoryProject` = 1"); while($row = mysql_fetch_assoc($test)) { echo "<li>" . $row['huvudProjectName'] . "</li>"; } ?> </ul> I want the 'huvudProjectName' be the name of a link. How can I do this? Also, I want this link to do a query when I click it for this: SELECT * FROM `project` WHERE `projectHuvudId` = 1 And then show the result somewhere. Is this possible?
  24. Hi guys i typed and saved som text from my admin page, i tried displaying it in my home page but it has some html a nd some styles inlcuded, please how do i convert it to plain text, i already used htmlspecialchars and htmlentities , i noticed some.changes but what i want to is a plain text. This is what it gave me when i viewed it with "htmlspecialchars" <font face="Times New Roman"><b><font size="5">You Are welcomevv</font></b></font> and here is the code i used in displaying-: echo htmlspecialchars($object->data['page-body']) ; Please i need your help. Thanks.
  25. DISCLAIMER: this is my first time on this site, and I am a very beginning programmer still in high school, so please bear with any mistakes I might make. (if you have ANY advice or comments, feel free to share them with me, any help is appreciated) I am basically looking to make a series of css checkboxes (I only have one right now for testing purposes), which will submit onclick and store the value in a txt file. Upon loading, it will read that text document and set the checkbox default to what it was before. I could use the PHP session method, but I would like the default to carry on through reboots, etc. Currently, the file current.txt has a 1 in it, but the checkbox is still off. When I click the checkbox, it refreshes, but then goes back to off. any advice? <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> <body> <form action="index3.php" method="post"> <div class="onoffswitch"> <?php //writing to the file with the results of POST $my_filew = 'current.txt'; $handlew = fopen($my_filew, 'w'); if (isset($_POST["onoffswitch1"]) && $_POST["onoffswitch1"] == "on") { fwrite($handlew,'1'); fclose($handlew); } if (isset($_POST["onoffswitch1"]) && $_POST["onoffswitch1"] == "0ff") { echo "hello"; fwrite($handlew,'0'); fclose($handlew); } //reading from the file and setting the default $my_filer = 'current.txt'; $handler = fopen($my_filer, 'r'); $datar = fread($handler,filesize($my_filer)); fclose($handler); if ($data == 1) { $checked="checked"; } else { $checked=""; } //outputting the html $option='onclick="setTimeout(function() {submit();},1250);"'; echo '<input type="checkbox" name="onoffswitch1" class=onoffswitch-checkbox" id="myonoffswitch" '.$checked.' '.$option.'>'; echo "\n"; ?> <label class="onoffswitch-label" for="myonoffswitch"> <div class="onoffswitch-inner"> <div class="onoffswitch-active"><div class="onoffswitch-switch">ON</div></div> <div class="onoffswitch-inactive"><div class="onoffswitch-switch">OFF</div></div> </div> </label> </div> </form> </body> </html>
×
×
  • 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.