Jump to content

Dat

Members
  • Posts

    49
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Dat's Achievements

Member

Member (2/5)

0

Reputation

  1. What if i already have a __construct?
  2. How do i use a class inside of another class? I have class blogPost and class database. How do i use database inside class blogPost class blogPost { include ('database'); $db = new database; }
  3. Im trying to dynamically add more fields into my form. HTML: <table id="add_episodes" class="editor" border="0" cellspacing="0" cellpadding="5"> <tr> <td><input size="3" type="text" name="number" /></td> <td><input type="text" name="title" /></td> <td><input type="button" value="Add another text input" onClick="addInput('add_episodes', 'number');addInput('add_episodes', 'title');"></td> </tr> <tr> <td></td> <td></td> <td> <input name="entry_id" type="hidden" value="<?php echo $id; ?>"> <input class="input submit" type="submit" name="submit" value="Add <?php echo $type; ?>"> </td> </tr> </table> Javascript function addInput(divName, type) { var counter = 1; var limit = 50; if (counter == limit) { alert("You have reached the limit of adding " + counter + " inputs"); } else { var tr.document.createElement('<tr>'); if(type == 'number') { var newdiv = document.createElement(element); newdiv.innerHTML = '<input size="3" type="text" name="number" />'; document.getElementById(add_input).appendChild(newdiv); } if(type == 'title') { var newdiv = document.createElement(element); newdiv.innerHTML = '<input type="text" name="title[]" />'; document.getElementById(divName).appendChild(newdiv); } counter++; document.getElementById(add_input).appendChild(tr); } } This is one of my first times working with javascript, usually i work with PHP. Im trying to add more input elements of <tr> <td><input size="3" type="text" name="number" /></td> <td><input type="text" name="title" /></td> </tr> And don't reply that i should make the names into arrays for me to submit more stuff, I'll change that later. But for simplicity and a straightforward problem. I can't get it add more form elements in the correct place or nothing happens at all.
  4. So I wanna create redirects after a form is complete. Here is how it goes, I have the information page and "edit new info" link, which links to the form to edit new info. And... i have another link on the Control panel page which also links to the form to edit info. I want it so if i submit a form i can go back to w/e page I originated from. info page -> Form -> info page CP page -> Form -> CP page So what i created is this a link Example: <a href="www.domain.com/cp/form.php?category=apple&id=1&redirect=www.domain.com/cp/?category=apple&id=1">Edit category</a> Obviously you see the prob the redirect $_GET stops after apple cause of the '&' Any solutions?
  5. SOLUTION: <?php $query = "SELECT title FROM entry WHERE entry_id='$id' AND type='$type'"; $result = mysql_query($query); $data = mysql_fetch_array($result); // Add this $num = mysql_num_rows($result); //Edit this if($num = 1) { ?> <form> The form </form> <?php } else { echo $data['title']; } ?>
  6. Still came out as true. :'(
  7. So what I want to do is check if there is a entry for a specified title already in the database, if there is no entry then output the form for it. otherwise just display the 'title' of the entry. Pretty simple i'd say There are no mysql_errors(); The problem is it keeps coming out as "TRUE" and keeps outputting an empty 'title' or the listed title. Please help. <?php $query = "SELECT title FROM entry WHERE entry_id='$id' AND type='$type'"; $result = mysql_query($query); $data = mysql_fetch_array($result); if(!$result) { ?> <form> The form </form> <?php } else { echo $data['title']; } ?>
  8. Ohh for like a year now i've been wondering what that is called! Thank you! Is there a resource where i can learn more terminology of UI?
  9. How do i make a script that does something like on http://www.anime-eden.com/ under latest anime. When you hover over the link it will give more information about it. I tried to read the code and find it. It just sets the information in the title and i found that it has the mootools framework.
  10. Oh I found a problem with this solution I have data entries that start with numbers and other stuff like _ I want to order these extra stuff under #
  11. I found the solution thanks anyway. http://www.phpfreaks.com/forums/index.php/topic,218512.0.html
  12. I have an array retrieved from a database called say $row $query = "SELECT * FROM entry WHERE type='$type' ORDER BY title ASC"; I have a loop set up already but Im stuck: while($row = mysql_fetch_array($result)) { echo $row['title']; } and I know how to make an alphabet PHP Code: <?php for($i = 97; $i < 97 + 26; $i++) { $letter[] = chr($i); } foreach($letter as $value) { ?> <li id="<?php echo $value; ?>"> </li> <?php }?> How do I make an alphabet with the title names to match with their respected letters? Like a list A apple ankle B battle bait burn C cookie and so on.
  13. I found that this approach is the best solution but there is a problem with it: if ($USERCAN[viewuserlist] == 1) { $content = "<a href="$SITE[urlusers]/userlist.php">View Memberlist</a><br /><br /><br /> <b>User Links</b><br /> <a href="$SITE[urlusers]/logout.php">Logout</a><br />"; } As you can I have to add \" to every freaken quote!
  14. You can try create a page for your session() and include that file your session() in your every pages... Example please? And a newbie explanation please xD
  15. What is the best way to display this: <?php if ($USER[loggedin] == true): ?> Welcome to $SITE[sitename] $USERS[username], <?php endif; ?> The arrays have values. My question is what is the best and easiest way to echo these arrays? Obviously you can place '<?php echo $SITE[sitename] ?>' but I want to know an alternative because I will be placing these arrays all over my site. It would be tedious work to place echoing and php syntax's everywhere.
×
×
  • 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.