Jump to content

littlejones

Members
  • Posts

    12
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

littlejones's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Here's one for you... I have a form with 4 checkboxes. When the form is submitted those that are checked are stored in the database in 4 separate fields as "yes" or left null if they were not checked. So, I then want to display on a page the categories (checkboxes) that the person has checked. Obviously I want to separate these with a comma or an & sign. However I don't want a comma or & sign to appear if part of the array is empty. So as an example... 4 categories: General, Immigration, Housing, Employment. The user checks Immigration and Employment. These are stored in the database in fields categoryImmigration and categoryEmployment with the record "yes" and the other two (categoryGeneral and categoryHousing) are left blank. I now want to display the categories on a page in the format...  Immigration Team, Employment Team. So I SELECT * FROM the table with these fields in. I store the results as follows... [code] $categoryGeneral = mysql_result($result,$i,'categoryGeneral'); if ($categoryGeneral == "yes") $category[0] = "General"; $categoryImmigration = mysql_result($result,$i,'categoryImmigration'); if ($categoryImmigration == "yes") $category[1] = "Immigration Team"; $categoryHousing = mysql_result($result,$i,'categoryHousing'); if ($categoryHousing == "yes") $category[2] = "Housing Team"; $categoryEmployment = mysql_result($result,$i,'categoryEmployment'); if ($categoryEmployment == "yes") $category[3] = "Employment Team";[/code] That's fine, and now I have the result stored in the array $category[] I then need to display on the page. As you can now see, I can't do it in the following way, because if a user didn't select one of the checkboxes there would be a redundant comma.. [code]echo $category[0].", ".$category[1].", ".$category[2].", ".$category[3];[/code] In this example, the following would be displayed on the page... , Immigration Team, , Employment Team Obviously unacceptable. How can I get around this? Thanks a million in advance I have a deadline to meet!!  :o
  2. I notice that your forms action is set to $PHP_SELF yet there is no php or included php files in the form.php page? The code that handles the form seems to be in web2mail.php.
  3. Did data come through in the email for the other forms that you didn't modify, or is no data showing up in the email?
  4. try header("location:modify.php"); Make sure it comes before any other headers are sent (so before your html tags - might aswell stick all the code at the top of the page).
  5. In emailupdate.php where does the ELSE and WHILE statement continue to? If that is it then you forgot to close them. [code]     //query Start                        $uSql = "SELECT full_name, company, email, category FROM emailadd WHERE UserID='$eid'";     $uResult = mysql_query($uSql, $connection);     if(!$uResult){     echo 'no data found';     }     else{     while($uRow = mysql_fetch_row($uResult)){     //query end     ?> [/code]
  6. Have you actually put anything in the php tags? Try this as an example... [code] <html> <head><title></title></head>           <body>             <?php echo "HELLO PHP FREAKS!"; ?>       </body> </html> [/code]
  7. Yes it's done using $_GET Each navigation link would have a particular url in such as <a href="index.php?page=aboutUs" /> Then in the code you would put [code] $page = $_GET['page']; if($page == "aboutUs")   {     //echo the html for the aboutUs page here   } elseif($page == "contactUs")   {     //echo the html for the contactUs page here   } [/code] Does that make sense? If you wanted to split it up then you could just do each page as an included file, so put all of the html for the aboutUs page in a aboutUs.inc.php and contact us in contactUs.inc.php and then do the following [code] $page = $_GET['page']; if($page == "aboutUs")   {     includes("aboutUs.inc.php");   } elseif($page == "contactUs")   {     includes("contacUs.inc.php");   } [/code] In which case you may have well just have made each page separately anyway.  :P
  8. What doesn't work and what errors are you getting?
  9. So you want the form to physically change before the person presses the submit button? Sounds like a job for javascript which will save you having to keep going back to the server for each song. I don't totally understand what you're trying to do in terms what you are referring to as 'adds a line to add another song' but you might want to look into javascript's onChange function.
  10. The problem is that because I'm using FCKeditor rather than my own upload feature I can't think of an easy way to change the path before it displays at the front end. So for instance, in the CMS the user clicks the image button built into the WYSIWYG editor (FCKeditor), uploads an image and then it is stored in that folder and displayed in the CMS textbox. The user then saves the record and it is sent straight to the database, along with all the other information in the text box, so for instance it could be stored as the following... blblabaablabal balablabalaba lots of information bla bla bla <img src="../../www/uploaded_files/" alt=""/> blasdf bla bla blasd more information In order for it to display in the CMS it needs the full file path as shown above, otherwise if I just put /uploaded_files/ it will create a new folder within the CMS direectory. So as you can see, when I pull this information back out of the database at the front end, for instance... "SELECT content FROM news" it just bring out everything and looks for an image at ../../www/uploaded_files I'm not sure how I could write a simple piece of code to strip this off when it comes back out of the database, as I can't do it before otherwise it won't show in the CMS. Thanks
  11. Hi, I need a little help with a site I've been building. I built the CMS part of a site and included within it FCKeditor text boxes with the functionality for users to upload images. Originally these images were uploaded to a folder in the CMS directory, and then the data from the form is saved into the database. Then, on the front end of the website I pull the data back out of the database and display it on the webpage. My problem is that I want the image to display on the front end and on the back end when the user originally uploads it. Because the CMS is in the CMS folder and the front end website is in the WWW folder I can't understand where I should be getting the images to upload to from the CMS and still enable them to be viewable on the front end. In other words I can't change the url for the file from when it is saved into the database to when it is pulled back out again. This is a problem because currently the files are being uploaded to /data/betawebs/lawrencelupin/www/uploaded_files from the CMS, and this enables them to be uploaded to the WWW folder instead of the CMS folder. However on the front end of the site the url is looking for the file at http://www.websiteaddress.net/data/betawebs/lawrencelupin/www/uploaded_files when really the file is stored in http://www.websiteaddress.net/uploaded_files I'm sure it is far far less complex than I've made it out to be, but I've either explained it really well or made it 10 times more confusing that it should be. I hope somebody can help!  ;)
×
×
  • 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.