Jump to content

bullbreed

Members
  • Posts

    110
  • Joined

  • Last visited

Everything posted by bullbreed

  1. HI everyone. PHP newbie here. I've been learning php for a couple of weeks now and I love it. My websites can now do things that they have never been able to do. woohoo. Thanks for all your help guys. I would like to develop a calendar that when clicked inserts that date into a form field. Has anyone any idea where to start. Basically the user fills in a form with his name and address, then clicks on a calendar date to let me know when he is available to attend my office. The calendar can be just sat on the page but when the date is selected it fills in the form field so when he submits the form th date and other info goes to the database. I could look on hot-scripts and the like but I'm enjoying learning it so much that perhaps a little help would improve my php skills. Thanks in advance. Bullbreed
  2. woooooooohoooooooooooo It worked. Your a star. :D :D :D Thanks You!
  3. I am calling a php function in the value of a form field to get a company name from the database. It works but the value returned in the form field is pushed over to the right. It seems as though this part of the PHP code (echo $session->userinfo['companyname'] is being included in the form field, but, it is invisible to the user. Company Name: <input type="text" name="companyname" maxlength="50" value=" <?php if($form->value("companyname") == ""){ echo $session->userinfo['companyname']; }else{ echo $form->value("companyname"); } ?> "> How weird is that. Any help would be greatly received. <?php echo $form->error("companyname"); ?></p>
  4. Hi. I have a page on my website that echos out lots of information about a registered user like; Name, Address, telephone, Email and any user submitted information that the admin would find useful. Could anyone point me in the right direction for any code that would convert the whole page to PDF then download it to the admins computer? Thanks in advance
  5. I think I know why this is happening and it isn't the CSS. When I look at the form field in Code view in Dreamweaver I can see the following line of code the form field; <?php if($form->value("name") == ""){echo If you look in the code I submitted in the post below you will see it is part of the php function but it is causing the VALUE of the variable to be pushed over to the right to accommodate the code that you don't actually see in the field when the page is uploaded. Does anyone know how to sort this out im racking my brains. :'(
  6. Maybe not a php question but here goes; I have a form field set up where you can edit your user information such as Name, Address, Email etc But the text is aligned to the right in the field and half of it goes beyond the right edge of the field so it looks as though half of the info is missing. HAs anyone come across it before Heres the code <p class="grid_2">Name: </p><p class="left"><input class="left" type="text" name="name" maxlength="50" value=" <?php if($form->value("name") == ""){ echo $session->userinfo['name']; }else{ echo $form->value("name"); } ?>"><?php echo $form->error("name"); ?></p>
  7. I am trying to get the date to show on my page in a particular way. I have a database Table called 'actions' set up like this; Field------------ Type------- Collation-------Attributes------Null--- Default date------------ timestamp------------------------------------------No-----CURRENT_TIMESTAMP My code that requests the time is; $date = time(); I insert it in to the database like this; $queryreg = mysql_query("INSERT INTO " . TBL_ACTION . " ( `date`) VALUES ('$date')"); I call the date to the page like this <?php echo $data['date']; ?> But this shows the date on my page like this Thu 1st January 1970 12.00AM What am I doing wrong?> I want it in this format but with the current data and time
  8. wow. You little beauty. I couldn't get this right for nothing. Your a star. Thank you :D :D :D
  9. Hi I have a page called clientinfo.php This page shows information related to a user like this clientinfo.php?username=john Also on this page I have a form that submits itself to the same page for processing. The information that the form submits is shown on the same clientinfo.php?username=john page that the form has just submited itself to. But althought the page submits to itself I still have to press refresh to see the newly subitted data. How can I get the page to refresh itself when the form has been submitted so the data is shows on the page immediately.
  10. I've tried it lots of ways and cant get it to work. I know i os probably me. Heres my code; <form action="clientinfo.php?username="'.$_GET['username'].'"" method="POST"> Is that right?
  11. $q = 'SELECT status FROM advert WHERE id = '.$id; Have you tried removing the . before $id;
  12. Sorry, here it is <?php $submit = $_POST['submit']; //Form data $action = addslashes(strip_tags($_POST['action'])); $username = addslashes(strip_tags($_POST['username'])); $client = addslashes(strip_tags($_POST['client'])); $date = date("Y-m-d"); if ($submit){ //Check for existing fields if ($action && $username){ //Register the user $queryreg = mysql_query("INSERT INTO " . TBL_ACTION . " (`action`, `username`, `teammember`, `date`) VALUES ('$action', '$client', '$username', '$date')"); echo("<td><font size=\"2\" color=\"#0066FF\">The action has been udated! </font><td>"); }else{ echo "<td><font size=\"2\" color=\"#ff0000\">Please complete <b>ALL</b> fields</font><td>"; } } ?> <?php if($form->num_errors > 0){ echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>"; } ?> <form action="clientinfo.php" method="POST"> <p class="textinput">Action taken: </p><p><textarea name="action" cols="50" rows="5" value="<?php echo $form->value("action"); ?>"></textarea><?php echo $form->error("action"); ?></p> <p><input type="hidden" name="client" maxlength="30" readonly value="<?php echo $_GET['username']; ?>"><?php echo $form->error("user"); ?></p> <p><input type="hidden" name="username" maxlength="30" readonly value="<?php echo $_SESSION['username']; ?>"><?php echo $form->error("user"); ?></p> <input type="submit" name="submit" value="Submit"> </form> </div> The URL currently reads clientinfo.php?username=john Can the <form action="clientinfo.php" method="POST"> Be something like <form action="clientinfo.php?username=current url username" method="POST"> Because I could be reading one of many different clients information so the url could contain a different users name if im viewing someting else
  13. HI I have a page on my website called clientinfo.php. This page echos data from the database about a particular client so the url shows; clientinfo.php?username=john at the bottom of the page is a form that submits some information in to the database This information is echoed to the same page as it was submitted from; clientinfo.php?username=john But when the user clicks submit to send the new data the url changes to clientinfo.php So the url in the client page containing johns information changes. The user who submitted the info has to click the back button to return to the client page; clientinfo.php?username=john And click refresh to see the new data added to the page How can I make it so when the user clicks the submit button the page remains at; clientinfo.php?username=john And the data on the page refreshes itself. I think this might be really hard to do so asking for any help. Thanks
  14. Hello PHP masters I have a page on my site called client info.php. This page shows information specific to one of my clients. I have a table in the db called trainingdata that holds the following info id-------description-------date-------username------dateactioned-------action The id, description, date and username have data that was collected when the user completed a form. dateactioned and action are empty columns I would like to be able to add data to the these empty ones by filling in a form on my page but it has to fill in the empty columns and not add a new row to the table because the info is associated with that user and that particular row of info as it will be displayed on the same page in the same html table. I cant do it Here is what I tried <?php $submit = $_POST['submit']; //Form data $action = addslashes(strip_tags($_POST['action'])); $dateactioned = date("d-m-Y"); if ($submit){ //Check for existing fields if ($action){ //Register the user $queryreg = mysql_query(" INSERT INTO " . TBL_TRAININGDATA . " (`action`, `dateactioned`) VALUES ('$action', '$dateactioned')"); echo("<td><font size=\"2\" color=\"#0066FF\">Your training request has been sent successfully. <br /> We will be in touch with more details.</font><td>"); }else{ echo "<td><font size=\"2\" color=\"#ff0000\">Please complete <b>ALL</b> fields</font><td>"; } } ?> Obviously this code doesn't add it to the users row. It adds a new row to the database.It also doesn't make it relevant to that user. I hope I have explained it well enough. Thanks
  15. bullbreed

    Inner JOIN

    Hi Here is an INNER JOIN I used yesterday $sql = "SELECT `users`.`name`,`users`.`username`,`users`.`email`,`trainingdata`.`description`,`trainingdata`.`date` FROM `users` INNER JOIN `trainingdata` ORDER BY dato DESC");"; My two tables in the statement are 'users' and 'trainingdata' so you seem to have missed out what rows you want to call from your member_tutorials table. Unless you want them all in which case call *
  16. You dont need PHP to style your aktive links you can do it all through css Just define a class for the active page .page { padding: 5px 9px 5px 9px; color: #999; font-family: 'Century Gothic'; font-weight: normal; text-decoration: none; background-color: #141414; border: solid #990000 2px; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } Then just ad a span to it like this <li><a href="index.html"><span class="page">HOME</span></a></li> Id your menu dynamically driven?
  17. \is your code inserting anything in to the database? Also your date column in your MySQL database shoul dbr set like this; Field---Type---Collation---Attributes---Null---Default---Extra--- Action date date No None Are you checking the form data and defining variables <?php $submit = $_POST['submit']; - (This is the name of your form) //Form data $description = addslashes(strip_tags($_POST['description'])); $all your other variables here $date = date("Y-m-d"); if ($submit){ //Check for existing fields if ($description, $other variables, ){ //Register the user $queryreg = mysql_query(" INSERT INTO Customer (`description`, `other variables`, `date`) VALUES ('$description', `$other variables` $date')"); ?> have a play around with it but use the quotes around your inserts and intos
  18. What does the AKTIV class do. Is it just so show that the link is active?
  19. $date = date("Y-m-d"); Put this below you other data variables
  20. You just define a variable called $date and add it to your INSERT code $query = "INSERT INTO Customer ('Firstname', 'Surname', 'Username', 'Email', 'Password', 'Address', 'PostCode', 'City', Country date) VALUES ('$newFirstname', '$newSurname', '$newUsername', '$newEmail', '$newPassword', '$newAddress', '$newPostCode', '$newCity', '$newCountry', '$date')"; Make sure you have a date column in your database called date with a value of date
  21. Thats fantastic, thanks mate. I see what you mean about duplicating the data. It doesn't look so bad but it is unnecessary. Although I dont think that a user will ask for more than 5 training requests. How would I put a line break between the 2 results.
  22. eh? Im a bit dumb sometimes mate and its 2:00am here in the uk. lol Could you explain a little more please
  23. how cool ws that. Thanks matey. now, that limit=1 you called. What of a user has 2 rows in the trainingdata table So he had submitted 2 different descriptions against his username
  24. Think I did it woohoo <table> <tr> <th>Name</th> <th>Username</th> <th>Email</th> <th>Training Required</th> <th>Date Submitted</th> </tr> <?php $sql = "SELECT `users`.`name`,`users`.`username`,`users`.`email`,`trainingdata`.`description`,`trainingdata`.`date` FROM `users` INNER JOIN `trainingdata` USING (`username`) WHERE `users`.`username`='".$_GET['username']."' LIMIT 1"; $sql_query = mysql_query($sql) or trigger_error(mysql_error()); if (mysql_num_rows($sql_query) > 0) { $data = mysql_fetch_assoc($sql_query); } ?> <tr> <td><?php echo $data['name']; ?></td> <td><?php echo $data['username']; ?></td> <td><?php echo $data['email']; ?></td> <td><?php echo $data['description']; ?></td> <td><?php echo $data['email']; ?></td> </tr> </table>
×
×
  • 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.