Jump to content

WesleyA

Members
  • Posts

    172
  • Joined

  • Last visited

Everything posted by WesleyA

  1. Is it one way or another possible to put php code inside a html input tag? I was looking for a html tag to identify exactly how an input variable should have an index.
  2. yeah I was figuring out something in that direction, but just adding [] to runame is not possible, in array it gives a fatal error report due to [].
  3. If its easier and you need it for a loop then I go fo the array. I'm stuck with the following script. <?php echo "<form method = 'POST' target = '_blank'>"; for($x = 0; $x < 5; $x++) { echo "<input type = 'text' name = 'runame' /></br>"; } echo "<input type = 'submit' value = 'send' /> "; echo "</from>"; //// if (isset($_POST['runame'])) { $runame = $_POST['runame']; for($x = 0; $x < 5; $x++){ $test[$x] = array($runame => $x); } } if (isset ($test)) { echo "<pre>"; for($x = 0; $x < 5; $x++){ print_r($test[$x]); } echo "</pre>"; } ?> Only the last entry is taken. I also want the first four entries.
  4. The idea is to insert with the browser a multiple input field, a loop, into mysql database. Is the solution to first put this loop input variable in an array and after that create in this case multible tables? Or is an array not necessary?
  5. I have a script and a MYSQL query its supossed to create a new table $variable now I have $sql = "CREATE TABLE '$variabele' "; But it doesnt work. I think CREATE TABLE works for constants not for variables. Which query should I use?
  6. I fixed the script meanwhile
  7. When writing scripts I do not only face the problem of how a condition works but that is the lesser problem because you can find tons of scripts and examples online. The real issue is WHEN. WHEN do I have to use a condition like isset/empty. Which type of variables are generally demanding a condition. I know programmers distinguish primitive and complex variables. But there might be more categories of variables. Anyway when creating a script the issue is more to know how to discover what has to happen. Some variables are just shown by the browser you can say: $var = 'hello world '; echo $var; But when the variable $var becomes variable or retrieves data from a database or array then it gets more complex. Is it so that these variable variables require a condition? And what is the exact name of this type of variables? And what is the reason that PHP (or a programming language in general) has determined that conditions should be set in these matters?
  8. I made a set up for showing tables with a php script. Its based on a script from w3schools. // make connection with localhost $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } // script calling to connect with dbase function write_content () { // reading the tables from the dbase $sql = "SHOW TABLES"; // show tables $result = $conn->query($sql); while ($row = $result->fetch_assoc()) { echo current($row) . '<br/>'; } $conn->close(); return; } echo "<br><br><br>"; echo "The following tables are found in the database " ; echo write_content (); The problem is that conn is a not defined variable.though it worked in a condition with if. Then a second error message is given sounding: Fatal error: Call to a member function query() on a non-object in ..... these errors concern this line: $result = $conn->query($sql);
  9. @thescientist: NO, exactly the opposite. But i dont think the book is released in in any other than my own (dutch).
  10. Ok thanks I was there already. The problem too is that since last year programmers work with the mysqli extension instead of mysql, so the php book (in my own language which is NOT present @ php.net) I bought became partly useless. But I quited this array_push matter meanwhile. I switchted to MYSQL giving me more chance to find scripts etc and more structure in a more complex built database.
  11. I dont see it. I see no possibility to add values on the same record in phpmyadmin. Even if I delete the last record and make a new one then another record is added. with INSERT INTO you can also add another column and value, is there a way to add a record number and in what way?
  12. When I add a new column in MYSQL in phpmyadmin a new row is created (i guess its called a row) for example: if i first did this query with a php script. $sql = "INSERT INTO MyGuests (firstname, lastname, email)VALUES ('John', 'Doe', 'john@example.com')"; And later I go to phpmyadmin and add in MyGuests (telephonenumber) and VALUE this with 12345678 then this is done in a new row. I would rather have this all in one row. Can you maximize the number of rows and still add columns.
  13. I have it running. But I had to call the function addIntoArray($var) Now I want to check if the variable is added to the array. I already had an array, with elements and I want to print the entire array with its content on the screen. It is not that I cant find the codes. My problem when programming is that I dont know much about the principles, such as type signature, declaration, definition. Are there any resources online that explain more about these logic that is behind a programming language like specifically PHP?
  14. I want to add elements by the browser into an array with the name $map I wrote the next piece of code for this: <?php $var = $_POST["var"]; function addIntoArray($var) { global $map; if (($var != ".") || ($var != "..")) { array_push($map, $var); echo $var . " succesfully added to the array!"; } return; } ?> The problem though, is not having an error code, but the screen just does not give an output at all while I did make an echo line. Whats going wrong here?
  15. OK this works thanks a lot dsonesuk. What is the explanation of this code?
  16. I want to create a condition for my script. It starts with reading an array, this array can be unlimited, at least 4 up to 40 elements. These elements contain 2 variables. I figured out foreach is a better solution than switch (which I use now) In the next example (simple version of my above purpose) I show what I indicate. <?php $elements = array('Volvo', 'Honda', 'Ford'); ?> <form method="post"> <select name="menudrop"> <?php foreach ($elements as $value) : ?> <option value="<?php echo $value ?>"><?php echo $value ?></option> <?php endforeach; ?> </select> <input type="submit" value="submit" /> </form> <?php if (in_array($_POST['menudrop'], $elements)){ echo 'Clients enjoy eating a ' . $_POST['menudrop']; } ?> The problem is an error. The line with the error is: if (in_array($_POST['menudrop'], $elements)) what exactly does this error mean? The script is running and all things are executed like I intended, but I still get an error message at the screen. Notice: Undefined index:
  17. I give an example of how it works. It is with embedded CSS and I want a separated CSS script. I made this with KOMPOZER. <html><head><meta content="text/html; charset=ISO-8859-1"http-equiv="content-type"><title>footcol1</title></head><body><table style="text-align: left; width: 1841px; height: 760px;"id="mainrow" border="0" cellpadding="80" cellspacing="2"><tbody><tr><td style="vertical-align: top; height: 117px;">Header<br></td></tr><tr><td style="vertical-align: top; height: 542px;"><table style="text-align: left; width: 288px; height: 368px;"border="0" cellpadding="2" cellspacing="10"><tbody><tr><td style="vertical-align: top;"><br><br>place text here in column<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></td></tr></tbody></table><br></td></tr><tr><td style="vertical-align: top; height: 91px;">footer<br></td></tr></tbody></table><br><br></body></html> If you load it in the browser you'll see the footer go down, when adding more text solely in the column. I'm looking for a way to have this in an external style sheet. Is there a converter from embedded html to external CSS? But more preferably (to understand and learn CSS better) I would like to know how to do it myself with CSS, so as done in the above script.
  18. I cant get it working. Basically when I add text (for instance in a div) to the script its the same effect, the text outside the column moves the footer down, but I want the resizing of the column to move the footer. Finally where wont be any text outside the column, only more columns, say three or more.
  19. Ok this is the script I wrote. If you add some lines to the column it will enlarge automatically. But if the column gets so big and approaches the footer then it overlays the footer instead of pushing it down. (in an alternative script I had the column enclosed into the div of the column, but then the left-margin is determined related to the columnn. with negative -px settings I had a bad result, so my question is if any of you knows another solution? Script <html><head><meta content="text/html; charset=ISO-8859-1"http-equiv="content-type"><title>footer-down</title><style type="text/css">html, body {margin: 0;padding: 0;height: 100%;}.container {min-height: 100%;position: relative;}.header {padding: 10px;background: none repeat scroll 0% 50%;background: green;}.content {padding: 10px 10px 80px;}.footer {bottom: 0;height: 60px;position: absolute;width: 100%;}.column1a {border: 2px solid #ff6600;height: 100px;margin-left: 600px;min-width: 200px;background-color: #ffcc99;float: right;max-height: 100px;max-width: 200px;font-family: Arial;width: 200px;display: table;position: absolute;min-height: 100px;margin-top: 70px;visibility: visible;font-size: 0.9em;padding-bottom: 10px;}</style></head><body><div class="container"><div class="header="> This is the header</div><div class="content"> Here you can write content<br>Line: abcdefghijklmnop<br><div class="column1a">Column <br>Here some text<br><br><br><br></div></div><div class="footer">Place the footer here<br><br></div></div><br><br></body></html>
  20. I have tried to add the following code: padding-bottom 5%; the strange thing is that it creates a distance in the bottom of the column, BUT when adding new text, the bottom does not move downwards.
  21. Ok I give an example from w3schools.com http://www.w3schools.com/cssref/tryit.asp?filename=trycss_overflow none of the overflow tag properties is giving the option tht I mean and that is that the text automatically adjusts the size of the cell. By default it does. But obviously it only works under specific circumstances because I cant change the bottom of the cell. this is the class I wrote for a column .kolom6 {border: 5px solid yellow;table-layout: auto;background-color: #ffcc33;font-size: 0.9em;width: 20%;font-family: Arial;margin-left: 52%;margin-top: 1%;height: 40%;display: table-column;position: absolute;color: black;line-height: 1em;border-radius: 15px 15px 15px 15px;} This is put in another table-row, above this row a header-row and a footer-row. I have now set most values of the rows to % so they can be recalculated, when text is added to the column.
  22. I'm having a thing I cant figure out in CSS I defined a class to make a table. The idea is that the table will be filled with text and its added frequently. The bottom border of the table should add a new line and augment. I tried several things, I also tried overflow-x auto, but I dont want a scrollbar. Is there a way to get rid of that scrollbar. Im using CSS3 It would be great if someone has a solution.
×
×
  • Create New...