Jump to content

Search the Community

Showing results for tags 'form'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

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


Languages

  1. Good day, I have a contact form that i pasted on this box, i have also attached the php and java script files that work with it. When i send a message via the contact form it does not send at all. it used to send successfully but it stopped. not sure where to look now. please advise what could be the problem. <div class="contact-details"> <!-- Contact Form --> <div class="contact-form wow bounceInRight"> <!--NOTE: Update your email Id in "contact_me.php" file in order to receive emails from your contact form--> <form name="sentMessage" id="contactForm" novalidate> <div class="col-md-6"> <input type="text" class="form-control" placeholder="Full Name" id="name" required data-validation-required-message="Please enter your name" /> <p class="help-block"></p> </div> <div class="col-md-6"> <input type="email" class="form-control" placeholder="email" id="email" required data-validation-required-message="Please enter your email" /> </div> <div class="col-md-12"> <textarea rows="10" cols="100" class="form-control" placeholder="Message (eg: message )" id="message" required data-validation-required-message="Please enter your message" minlength="5" data-validation-minlength-message="Min 5 characters" maxlength="999" style="resize:none"></textarea> </div> <div class="col-md-4 col-md-offset-5"><br><div id="success"> </div><button type="submit" class="btn btn-primary">Submit Message</button></div> </form> </div> </div> </div> </div> contact_me.js jqBootstrapValidation.js contact_me.php
  2. Hello, Im quite the noob so I need your assistance. Im building a website using squarespace and im trying to modify the checkbox section of the form through css. I would like every checkbox to have a different image and the items to be in 3 columns rather than one. So far i have managed to edit the size of the checkboxes and insert the same image in all of them (see attachment) but i cannot figure out how to individually edit every single checkbox differently. Please help. Thankyou! C
  3. I have changed the code, because it happens to me before with another code. The thing is my code is aparently ok but when you fill the form and send it the e-mail is not sent. Any idea, please? Thank you. I Attach the code and the html page. My web site is http://victorpan.com/contacto.html contacto.php correo.php
  4. I have a php code for a form but I don't know how to use it I started reading about php but still don't understand it. So when I use the code on the hosting my nav says the form is already sent so i had to stop using it. What should i do to receive e-mails from my form on my website. The fact is I even don't know if i put the code on the right place. Thank you very much!!!!! My website is http://www.victorpan.com/ I also attach the file with the code I want to use as a coment inside the code.contacto.php
  5. I have a form that I use to send me data that includes the &frac12; value. Instead of %00BD, I am getting %C2%BD. Can anyone tell me how to correct this, or if it's even correctable? Wayne
  6. I have the following code. When executed, if you select one button then select the other button, it does not clear the first button, so both buttons are selected. I can't see what I've done wrong. Any help? <!DOCTYPE html> <html> <body> <h2>Radio Buttons</h2> <p>The <strong>input type="radio"</strong> defines a radio button:</p> <form action="/action_page.php"> <tr> <td><select name="os0"> <option value="$5 donation">$5 donation $5.00 USD</option> <option value="$10 donation">$10 donation $10.00 USD</option> <option value="$25 donation">$25 donation $25.00 USD</option> <option value="$50 donation">$50 donation $50.00 USD</option> <option value="$100 donation">$100 donation $100.00 USD</option> </select></td></tr> <br><br> <tr> <td> <input name="on1" <input type="radio" id="memory" value="In Memory of"> <label for="memory">In Memory of: </label><br> <input type="radio" id="honor" name="honor" value="In Honor of"> <label for="honor">In Honor of: </label><br><br> </td> </tr> </form> </body> </html>
  7. I want to make a form with 3 dropdown which opens specific pages according to the input on HTML. How can I do that ?
  8. Sstewrt

    Sean

    Hi there, I'm currently trying to get a Submit Form to work correctly but am having issues with how I want the information to be used. On one page I will have the user fill out a name, title, date, piece of writing. Once they have filled out the required Information I want the name and title to appear on another page that acts as a link to the writing. I believe I have the form set up correctly but not sure how to get the functionality of the formaction. I'm pretty inexperienced with this and am learning as I go, Any help would be great, Thanks, S
  9. Sstewrt

    Sean

    Hi there, I'm currently trying to get a Submit Form to work correctly but am having issues with how I want the information to be used. On one page I will have the user fill out a name, title, date, piece of writing. Once they have filled out the required Information I want the name and title to appear on another page that acts as a link to the writing. I believe I have the form set up correctly but not sure how to get the functionality of the formaction. I'm pretty inexperienced with this and am learning as I go, Any help would be great, Thanks, S
  10. Hello all, I will preface by saying I know only what code I find online (mainly this site) to tweak my company's pages. I am currently working on a landing page via Instapage and have a sticky header and also a pop up form. The form is being truncated by the header and would be ever so gracious if someone could help me with the code to make the form show up on top of the header as well.
  11. I am not able to understand how to enter any other element under SVG. suppose if you have to put your form under the SVG CIRCLE then how you will do it. Or suggest any other idea how i can nest my form's input text field under SVG. I also want to know weather i can align any form's input field like we can align texts. please answere my questions.
  12. I'm making a simple contact form which works and I would like to have the user add in either their phone number OR their email. Both are fine, but at least one is required. I don't want to require both. Anyway, I created an if statement in my php code which works but when I have it return to the form, of course the form has been cleared of the user input. I then decided to create a javascript statement that does the same thing, but it clears the form as well. I personally hate it when that happens to me, so I want to make sure that whoever is filling out the form doesn't lose their information if they forget to input their phone number or email. I'm just learning to code, so I'm not sure what I should do to fix this problem. Is there some sort of HTML code I could use so that one of the two is required before the user hits the submit button? As I said before, I don't want to use the required function for either input. I appreciate any response! 😊
  13. Hi everyone, I am trying to have validation form, seem it doesn't work. what did I do wrong? If anyone can help, Thank you so much... Gary Taylor <?php $buzz = $buzz2 = ""; if ($_SERVER['REQUEST_METHOD'] == "POST") { if (empty($_POST['select'])) { $buzz = "<h2><color ='red'> >- </color></h2>"; $buzz2 = "<h2><color ='red'> -< </color></h2>"; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Welcome to ASL-PT Scoring</title> <link href="default.css" rel="stylesheet" type="text/css"> </head> <body> <fieldset> <h1>Welcome to ASL-PT Scoring website</h1> <table> <form action="login.php" method="post"> <select name="select"> <?php echo $buzz ?><option value="" >Please select the level</option><?php echo $buzz2 ?> <option value="Administrator">Administrator</option> <option value="License">License</option> <option value="Scorer">Scorer</option> </select> <caption>Please login to enter the site below:</caption> <tr><td>Username:</td><td class="td"><input type="text" name="user"></td></tr> <tr><td>Password:</td><td class="td"><input type="password" name="password"></td></tr> <tr><td colspan="2"><input type="submit" name="submitted" value="Login"></td></tr> </form> </table> </fieldset> </body> </html>
  14. Hallo everyone. Thanks for a great website. I have been trying for a few days to get a safe, working php form that saves input to mysql. I have looked at several examples from different websites. The problem is that the form values are being stored to the database before the form validation process is complete. I have tried wrapping the process.php code in a function and only calling the function after the validation code is done and implemented some checks in a desperate attempt to resolve the matter using some global variables and a function that checks if the validation has done their work. But even with all this.. the user input is written to the database before validation is complete. for example.. if the user inputs his name with a preceding space, and submits the form, the preceding space ends up in the database. also a user can press the submit button multiple times and with every press, the information is stored to the database.. I imagine someone could write code to click that submit button millions of times until my server storage space runs out.. Any help would be much appreciated. Thanks. Einston I only have two files.. currently: 1: index.php and 2: testreqfields.php <html> <head> <title>Registration Form</title> </head> <body> <?php $inputisgood = false; $nameisgood = false; $surnameisgood = false; $emailisgood = false; $passwordisgood = false; include "testreqfields.php"; ?> <link href = "registration.css" type = "text/css" rel = "stylesheet" /> <h2>Sign Up</h2> <form name = "form1" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" method = "post" enctype = "multipart/form-data" > <div class = "container"> <div class = "form_group"> <label>First Name:</label> <input type = "text" name = "name" value = "<?php echo $name;?>" required/> <span class="error">* <?php echo $nameErr;?></span> </div> <div class = "form_group"> <label>Surname:</label> <input type = "text" name = "surname" value = "<?php echo $surname;?>" required/> <span class="error">* <?php echo $surnameErr;?></span> </div> <div class = "form_group"> <label>Email:</label> <input type = "text" name = "email" value = "<?php echo $email;?>" required/> <span class="error">* <?php echo $emailErr;?></span> </div> <div class = "form_group"> <label>Password:</label> <input type = "password" name = "pwd" value = "<?php echo $pwd;?>" required/> <span class="error">* <?php echo $pwdErr;?></span> </div> <div class = "form_group"> <label>Gender:</label> <input type="radio" name="gender" value="female">Female <input type="radio" name="gender" value="female">Male </div> <input type = "submit" name = "enq_submit" value = "Submit" /> </div> </form> </body> </html> <?php function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } function sql_process() { //reset the global variable to be sure all code run again if there are errors in input. global $inputisgood; $inputisgood = false; //establish connection $servername = "localhost"; $config = parse_ini_file('../db_credentials/config.ini'); //create the connection $conn = mysqli_connect ($servername, $config['username'], $config['password'], $config['dbname']); //check connection if (!$conn){ die('Could not connect: ' . mysqli_connect_error()); } $sql = mysqli_select_db ($conn, $config['dbname']) or die("unable to connect to database"); //process if (isset($_POST['enq_submit'])){ $reg_name = $_POST['name']; $reg_surname = $_POST['surname']; $reg_email = $_POST['email']; $reg_pwd = $_POST['pwd']; $sql = "INSERT INTO registration (reg_name, reg_surname, reg_email, reg_pwd) VALUES ('$reg_name', '$reg_surname', '$reg_email', '$reg_pwd')"; echo("You have been signed up."); if (!mysqli_query($conn,$sql)){ die('Error: ' . mysqli_error($conn)); } } else { echo("Kindly use the form to sign up:"); }; } function ready_to_process () { global $nameisgood, $surnameisgood, $emailisgood, $passwordisgood, $inputisgood; if ($nameisgood) { echo ("##Name is good"); } if ($surnameisgood) { echo ("##Surnameame is good"); } if ($emailisgood) { echo ("##Email is good"); } if ($passwordisgood) { echo ("##Password is good"); } if ($nameisgood and $surnameisgood and $emailisgood and $passwordisgood) { echo ("##All input is good!"); $inputisgood = true; $nameisgood = $surnameisgood = $emailisgood = $passwordisgood = false; } } // define variables and set to empty values $nameErr = $surnameErr = $emailErr = $pwdErr = ""; $name = $surname = $email = $pwd = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["name"])) { $nameErr = "Name is required"; } else { $name = test_input($_POST["name"]); if (!preg_match("/^[a-zA-Z ]*$/",$name)) { $nameErr = "Only letters and spaces allowed"; } else { $nameisgood = true; } } if (empty($_POST["surname"])) { $surnameErr = "Surname is required"; } else { $surname = test_input($_POST["surname"]); if (!preg_match("/^[a-zA-Z ]*$/",$surname)) { $surnameErr = "Only letters and spaces allowed"; } else { $surnameisgood = true; } } if (empty($_POST["email"])) { $emailErr = "Email is required"; } else { $email = test_input($_POST["email"]); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "Invalid email format"; } else { $emailisgood = true; } } if (empty($_POST["pwd"])) { $pwdErr = "Password is required"; } else { $passwordisgood = true; } ready_to_process(); if ($inputisgood) { sql_process(); } } ?>
  15. I have used combo boxes for years in Access and the 'select' element on an html form is similar. All of the tutorials on w3 show how to fill the 'options' with literal values, but I would like to have the options be filled from a table in a database so the user can select one. I know this is probably a cross-topic item and I have an idea of how to go about it using javascript, php and sql, but I thought I'd ask if anyone knew of a procedure which is already created for this. In Access you just enter the row source for the combo box and the options are there - is there any kind of construct to do that for a 'select' element in html? Thanks
  16. Hello, this is my site: https://www.centrovision.com.gt/#contactanos I have a contact form here with a blue submit button. Actually, only if you are using Chrome the button is blue, if you are using Firefox or Internet Explorer, you just get a default no-style html button. Why doesn't Firefox comply with my css?(i don't care about i.e). Here's my css for the button: input[type="button" i], input[type="submit" i], input[type="reset" i], input[type="file" i]::-webkit-file-upload-button, button { color: #ffffff !important; background: #014780; border-width: 1px !important; border-color: rgba(93,182,46,0.03); letter-spacing: 0px; font-size: 16px; font-family: 'Roboto', Helvetica, Arial, Lucida, sans-serif !important; padding-left: 0.7em; padding-right: 2em; padding: 0.3em 1em !important; display: inline-block; margin: 0 0 0 15px; font-family: inherit; cursor: pointer; float: right; padding: 0.3em 1em; border: 2px solid; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; font-size: 20px; font-weight: 500; line-height: 1.7em !important; -webkit-transition: all 0.2s; -moz-transition: all 0.2s; transition: all 0.2s; }
  17. Hello. Is this the right place to Discuss W3CSS ? Or is that a separate forum ? I am not sure if this is a question, or suggestion - or both. https://www.w3schools.com/w3css/w3css_input.asp I have reviewed the INPUT and the TABLE information in the W3CSS pages, and can not locate the information I am after. I am wondering about the correct technique of using tables and forms in ONE. Ive two scenarios in mind. ONE: You display a table and EACH row contains its own FORM. it contains, text, an input field, and in the 3rd column, its own submit button. each form sends minimal data to get processed. TWO: you have an HTML form, and a table. There is ONE Form, with ONE submit button, but it has multiple table rows, containing text, input fields etc.. Is there an existing tutorial on this ? If not, can one be added to the W3CSS website (and a hyper link to/from the INPUT and TABLE pages).
  18. BACKGROUND: Good ideas are sometimes like luck, they come in streaks. Thanks to the experiential wisdom of this forum and those around me in the Galvanize collective workspace, I have decided to tarry a little longer with the reconstruction of my data base. Indeed, I have learned a new term -- normalization. What before I intended to achieve with row duplication I hope now to achieve with simple updates. In order to achieve this important structural change and still retain the benefits of the old structure, I must disengage one of my form's <fieldset>s and create from it a new form that is submitted manually and only occasionally. It would appear that the small changes to the separate table that this fieldset previously replenished with each new form submission can now be achieved with MySQL TRIGGER and UPDATE statements. This strategy has led to the following two questions: QUESTION ONE: Under the assumption that one can have only one $_POST variable per page how does one typically go about using the same $_POST variable for multiple forms on the same page? If I were to implement this task on my own, without the advice of others, I would create a bivariate if-. else if-, else- statement that tests for the present of one of two variables and then handles only that data associated with the form submitted. Is there another, perhaps more thorough, separation that does not include the creation of a separate form page? QUESTION TWO: When executing a MySQL TRIGGER that updates a single row value of a single column of a table different from the one that executes the trigger, will the DEFAULT setting for the UPDATE statement trigger a timestamp with the ON UPDATE CURRENT_TIMESTAMP? As always your wisdom would be well-appreciated. Roddy
  19. This script shows the fetched data in a modify form. In the old situation I used rec_num wich was corresponding to the record number in the database.table For security reasons I added a uniqid column to the table. So not like under with an input hidden attribute for uniqid. If possible I would like it to be stored in a session variable. This is doable like above, but outside the foreach loop only the last value is stored. How to connect every single uniqid value (for multiple records!) to the separated rec_num without users being able to see the uniqid? $value = $_POST['checkbox_values']; $i=0; foreach ($value as $values) { if (++$i > 10) break ; $element = explode(" / " , $values); $_SESSION['uniqid'] = $element[1]; var_dump($_SESSION['uniqid']); ?> <form action = "" method="post"> <input type ="hidden" name="rec_num[]" value="<?php echo $element[0] ;?>" > <!--<input type ="hidden" name="uniqid[]" value="<?php echo $element[1] ;?>" >--> <input type ="text" name="value1[]" value="<?php echo $element[5] ;?>" > <input type ="text" name="value2[]" value="<?php echo $element[6] ;?>" > <input type ="text" name="value3[]" value="<?php echo $element[7] ;?>" > <input type ="text" name="value3[]" value="<?php echo $element[8] ;?>" > <br> <?php } ?><br> <input type="submit" name="send" value="Modify "> </form>
  20. We're a small manufacturer. We need to create a form that allows a visitor to pick a few machine options and the form would generate the specs based on those choices. The customer wouldn't be ordering online -- it's just for reference purposes. I know it's embarrassingly simple but I've spent two hours digging around and I don't even know what you would call that type of form let alone find any examples. We, of course, need it to look good on a mobile device. Does anyone know of a site that I might find an example or what you would call a form like that so I can find one myself? Any help would be greatly appreciated. For example: 1. Choose series: Medium Duty Heavy Duty 2. Choose Equipment: Modular Complete T-14 R-10 T-24 R-15 T-34 R-25 Output based on the above choices: Capacity = Stroke = Thrust=
  21. I need two submit buttons in my form, first is going to show result in the same tab and another one is in another one. <submit target="_blank"> is not correct. <target="_blank"> is for <form> tag, right?
  22. Hi all, 1. I want to delete selected(checkbox) items from database(MySQL). Here I am not getting any error, but I couldn't do the delete function.2. Wants to play videos in website. Here videos storing into folder and also into database, but cannot playin website. I tried in many ways, but I couldn't. So, please help to make above mentioned functions workable. dashboard.php<form method="post" enctype="multipart/form-data"><input type="submit" name="delete" class="btn btn-primary" onclick="myFunction(id)" style="font-size: 15px; margin-left: 3em;" value="Delete" /></form><div><?php$query = mysqli_query($database, "SELECT * FROM video");while($row = mysqli_fetch_assoc($query)){$id = $row['id'];$name = $row['name'];$url = "../uploads";// $url = $row['url'];$fileextensionvalue= $row['fileextension'];echo "<span class='col-md-6'><div class='row'><div class='col-md-1'><label class='checkbox'><input style='margin-right:1em;' name='checkbox[<?php echo $id; ?>]' type='checkbox' id='checkbox[]' data-toggle='checkbox' /></label></div><div class='col-md-1'><a href='#' style='color:red;font-size:18px;'>$id</a></div><div class='col-md-10'><a href='#' style='color:red;font-size:18px;'>$name</a></div></div><center style='padding:25px;'><video width='320' preload='auto' controls><source src='$url' type='video/$fileextensionvalue;codecs='avc1.42E01E, mp4a.40.2, H.264, aac, FLAC, Opus, VP9, VP8, Vorbis''/></video></center></span>";}?></div><script type="text/javascript">function myFunction(id){var r=confirm("Are you sure to delete selected video/s ?");if(r==true){window.location.assign("deleteVideo.php?id=" + id);}}</script>deleteVideo.php<?phpinclude '../database/database.php';$sql = mysqli_query($database, "SELECT * FROM video WHERE id='$id'");if(empty($_POST['delete'])){Print '<script>alert("Please choose file/s to delete.");</script>';Print '<script>window.location.assign("dashboard.php");</script>';}else if(!empty($_POST['delete'])){foreach($_POST['checkbox'] as $id => $val){if($val=='checked'){$query=mysqli_query("DELETE FROM video WHERE id = '".$id."'");$result= mysqli_query($database, $query) or die("Invalid query");}}}?>
  23. I have a question form which have many question with select option of yes or no i need help. for example Question no 1 have 3 options which have 3 select field of yes or no <br><div class="form-group"> 1. <label for="q1"> Are you presently taking Tobacco/Alcohol/Drugs/Medicines in any form during the past 12 months? </label><br> Insured: <select name="q1opt1" data-placeholder="" class="flat-select" id="q1" type="select"> <option value="Yes" checked>Yes</option> <option value="No">No</option> </select> Spouse: <select name="q1opt2" data-placeholder="" class="flat-select" id="q1" type="select"> <option value="No" checked>No</option> <option value="Yes" >Yes</option> </select> Children: <select name="q1opt3" data-placeholder="" class="flat-select" id="q1" type="select"> <option value="No" checked>No</option> <option value="Yes">Yes</option> </select> </div><br> i want if user select yes of any one option Question No automatically show on below table in QUESTION NUMBER Field For example; Q1 or Q3 <table > <tr> <th style="width: 90px;text-align: center;">QUESTION NUMBER</th> <th style="width: 150px;text-align: center;">NAME</th> <th style="width: 150px;text-align: center;">ILLNESS OR INJURY</th> <th style="width: 150px;text-align: center;">DATES OF TREATMENT</th> <th style="width: 150px;text-align: center;">DATE OF RECOVERY</th> <th style="width: 150px;text-align: center;">NAME OF PHYSICIAN</th> </tr> <tr> <td><input type="text" name="questionno" style="width: 150px"></td> <td><input type="text" name="name" style="width: 150px"> </td> <td><input type="text" name="illnessofinjury" style="width: 150px"> </td> <td><input type="date" name="dateoftreatment" style="width: 150px;padding: 12px;height: 50px;"> </td> <td><input type="date" name="dateofrecovery" style="width: 150px;padding: 12px;height: 50px;"> </td> <td><input type="text" name="nameofphysician" style="width: 150px"> </td> </tr> </table> how can i do this with PHP? check my complete form and help me form.php
  24. Here I can upload videos successfully into database and videos are saving in appropriate folder named "uploaded". As I mentioned in question, once after uploading the video, if I refresh the browser the previously uploaded video is going saving in my database. Another question is, if I click on the video(displayed name in myvideo.php), video is not going to display instead I am getting "Object Not Found" error. I request you people to give me solutions to solve these problems. Below I am posting my code: myvideo.php: <div class="content"><div class="card"><div class="header" id="stand-fix" style="border-bottom: 1px solid #E1E1E1;"><?phpif(isset($_POST['submit'])){// $conn = mysqli_connect("localhost", "root", "", "videos") or die(mysqli_error());$name = (isset($_FILES['file']['name']) ? $_FILES['file']['name'] : '');$temp = (isset($_FILES['file']['tmp_name']) ? $_FILES['file']['tmp_name'] : '');move_uploaded_file($temp, "uploaded/".$name);$url = "http://localhost/xampp/htdocs/VS/uploaded/$name";mysqli_query($database, "INSERT INTO video VALUE ('','$name','$url')");}?><form action="myvideo.php" method="post" enctype="multipart/form-data"><div class="row"><div class="col-md-7"><h4 class="title">My Videos</h4></div><div class="col-md-3"><input type="file" name="file" class="btn btn-primary" style="font-size: 15px;"><br /></div><div class="col-md-2"><input type="submit" name="submit" class="btn btn-primary pull-right" style="font-size: 15px;" value="Upload"></div></div></form><?phpif(isset($_POST['submit'])){echo '<script language="javascript">';echo 'alert("Your video has been successfully uploaded.")';echo "window.location.href='dashboard.php'";echo '</script>';}?><hr width="50%"></div><div class="content" style="height: 30em; direction: ltr; overflow: auto;"><div class="row" style="margin-left:4em;" style="direction: rtl;"><?php$database = mysqli_connect("localhost", "root", "", "videos") or die(mysqli_error());$query = mysqli_query($database, "SELECT * FROM video");while($row=mysqli_fetch_assoc($query)){$id = $row['id'];$name = $row['name'];$url = $row['url'];echo "<p style='margin:0.5em;'><a href='watch.php?id=$id' style='color:red;'>$id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$name</a></p><br />";echo "<embed src='.$id.$url.'><video width='200' height='200' controls></video></embed>";}?></div></div></div></div> watch.php<?php$conn = mysqli_connect("localhost", "root", "", "videos") or die(mysqli_error());if(isset($_GET['id'])){$id = $_GET['id'];$query = mysqli_query($conn, "SELECT * FROM video WHERE id='$id'");while($row=mysqli_fetch_assoc($query)){$name = $row['name'];$url = $row['url'];}echo "<p style='font-size:20px;'><center>You are watching ".$name."</center></p><br /><embed src='.$url.'><video width='600' height='400' controls></video></embed>";}else{echo "Error!";}?>
  25. Hello, I have a question about how to send form data to the database, without reloading the entire page. I discovered working with xmlhttprequest. I managed to show text from another file by implementing a javascript function with xhr into my script. I don’t know much about javascript and don’t understand how a javascript form should be added to an existing function. Finally this should run a php script executing the code to add the form data to the database. <!DOCTYPE html> <html> <body bgcolor="grey"> <center> <br><br><br> <div style="height: 200px; width: 600px; border: solid 2px blue;"> <div id="kn_ze"> <form id="my_form" action=""> Give your name: <input type="text" name="fname"> <br> <input type="submit" value="Send" onclick="loadXMLDoc();"> <!-- <button type="button" onclick="loadXMLDoc()">send it</button> --> </form> </div> </div> <script> function loadXMLDoc() { /* document.getElementById("my_form").submit();*/ var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("kn_ze").innerHTML = this.responseText; } }; xhttp.open("GET", "prophp.php", true); xhttp.send(); } </script> </body> </html> test script to process the form data prophp.php : <?php echo '<br>test code here : '; if (isset($_POST['fname'])) { var_dump($_POST['fname']); // execute mysql queries } ?> 11) How are the form data placed in the existing function? (or should I create a second one? ) Maybe someone can help me out solving it.
×
×
  • Create New...