Jump to content

pneudralics

Members
  • Posts

    241
  • Joined

  • Last visited

    Never

Everything posted by pneudralics

  1. Sorry I was kind of busy and didn't have time to respond. I'm trying to write a code for uploading an image and thumbnail. I tried nesting bunch of if statements but I can't seem to get it to work. I want to have it where if the thumbnail image doesn't upload I don't want the main image to upload either vice versa. I'm trying to see if I can make an if statement true or false so it can check it before it uploads. My problem is I can't get the thumbnail to check to not upload if the main does not upload. When I nested it and the main image uploads it go on to the next if which is the thumbnail image and it won't be able to check anymore since it's already completed. //Set main image, thumbnail and writing image name to database to true $mainimagecheck = true; $thumbnailimagecheck = true; $databaseimagecheck = true; //Check for main image if ($thumbnailimagecheck = true) { if ($mainimagecheck) { if (move_uploaded_file ($_FILES['image']['tmp_name'], GALLERYUPLOAD."$newname2")) { echo '<font color="red">Main image uploaded successfully.</font><br />'; } } else { echo '<font color="red">Problem uploading main image.</font><br />'; } } else { echo '<font color="red">Main image didn\'t upload because thumbnail image didn\'t upload.</font><br />'; exit (); } //Check for thumbnail image if ($mainimagecheck = true) { if ($thumbnailimagecheck) { if (move_uploaded_file ($_FILES['timage']['tmp_name'], GALLERYTHUMBNAILUPLOAD."$newname2")) { echo '<font color="red">Thumbnail image uploaded successfully.</font><br />'; } } else { echo '<font color="red">Problem uploading thumbnail image.</font><br />'; } } else { echo '<font color="red">Thumbnail image didn\'t upload because main image didn\'t upload.</font><br />'; exit (); } //End image upload //If inputs empty do not load the database if ($mainimagecheck && $thumbnailimagecheck) { if (mysql_query("INSERT INTO gallery (image) VALUE ('$newname2')")) { echo '<font color="red">The images have been written to the database successfully.</font><br /><br />'; } else { echo '<font color="red">Images did not write to the database.</font><br /><br />'; } } else { echo '<font color="red">Images did not write to the database because main or thumbnail didn\'t upload.</font><br /><br />'; exit (); }
  2. Is there a way to assign an if statement to some kind of variable?
  3. I want to be able to check my nested if statements to see if it's true or false. How would I write that? EXAMPLE if (this is true and the 2nd if is true){ } else { } if (the first if is true){ } else { do this if the first is not true }
  4. Thanks I was just thinking about that. Do you know of a good tutorial that will teach that without using any other utilities? I would like to have just one box to upload and automatically create a thumbnail.
  5. Tried it and it still doesn't work. I tried it several other ways. Currently have it like the below: //Set main image, thumbnail and writing image name to database to true $mainimagecheck = true; $thumbnailimagecheck = true; $databaseimagecheck = true; //Check for main image if ($thumbnailimagecheck = true) { if ($mainimagecheck) { if (move_uploaded_file ($_FILES['image']['tmp_name'], GALLERYUPLOAD."$newname2")) { echo '<font color="red">Main image uploaded successfully.</font><br />'; } } else { echo '<font color="red">Problem uploading main image.</font><br />'; } } else { echo '<font color="red">Main image didn\'t upload because thumbnail image didn\'t upload.</font><br />'; exit (); } //Check for thumbnail image if ($mainimagecheck = true) { if ($thumbnailimagecheck) { if (move_uploaded_file ($_FILES['timage']['tmp_name'], GALLERYTHUMBNAILUPLOAD."$newname2")) { echo '<font color="red">Thumbnail image uploaded successfully.</font><br />'; } } else { echo '<font color="red">Problem uploading thumbnail image.</font><br />'; } } else { echo '<font color="red">Thumbnail image didn\'t upload because main image didn\'t upload.</font><br />'; exit (); } //End image upload //If inputs empty do not load the database if ($mainimagecheck && $thumbnailimagecheck) { if (mysql_query("INSERT INTO gallery (image) VALUE ('$newname2')")) { echo '<font color="red">The images have been written to the database successfully.</font><br /><br />'; } else { echo '<font color="red">Images did not write to the database.</font><br /><br />'; } } else { echo '<font color="red">Images did not write to the database because main or thumbnail didn\'t upload.</font><br /><br />'; exit (); }
  6. The below is what I use in my isset. I can't figure out how to not allow upload if 1 of 3 doesn't work. For example if the main image doesn't upload I don't want the thumbnail to upload or the code to write to the database vice versa. I tried doing an if (!empty).. to the $_Post but that didn't work. It adds the tmp name to the database. //Check for main image if (move_uploaded_file ($_FILES['image']['tmp_name'], GALLERYUPLOAD."$newname2")) { echo '<font color="red">Main image uploaded successfully.</font><br />'; } else { echo '<font color="red">Problem uploading main image.</font><br />'; } //Check for thumbnail image if (move_uploaded_file ($_FILES['timage']['tmp_name'], GALLERYTHUMBNAILUPLOAD."$newname2")) { echo '<font color="red">Thumbnail image uploaded successfully.</font><br />'; } else { echo '<font color="red">Problem uploading thumbnail image.</font><br />'; } //End image upload if (mysql_query("INSERT INTO gallery (image) VALUE ('$newname2')")) { echo '<font color="red">The images have been written to the database successfully.</font><br /><br />'; } else { echo '<font color="red">Images did not write to the database.</font><br /><br />'; }
  7. I have a php script to upload images. When it uploads... the name of the image gets put in the database. I was wondering if I delete the name how can I also delete the image in the folder?
  8. Can't figure why php is only returning one row of data. //Website url $websiteurl = WEBSITEURL; //Retrieve gallery info $galleryselect = "SELECT * FROM gallery ORDER BY id ASC"; if ($galleryresult = mysql_query ($galleryselect)) { while ($row = mysql_fetch_array ($galleryresult)) { $gallery = $row['image']; } } ?> <table width="800" align="center"> <tr> <td width="100%" align="center"> <?php echo '<img src="'.$websiteurl.'/images/gallery/'.$gallery.'">'; ?> </td> </tr> </table>
  9. Thanks you rock. It's been more than a year and just getting back to php.
  10. I have a small form to update a question. I'm trying to only allow alphanumeric characters except for the question mark. Everytime I try updating my database through the form it takes all the space away..? What is causing that? If I enter in...What cars do I like? It'll save and output... WhatcarsdoIlike? <?php //Update question and answer if (isset ($_POST['submit'])) { $pquestion = ($_POST['question']); $pquestion = preg_replace('/[^a-zA-Z0-9?]/', '', $pquestion); $panswer = ($_POST['answer']); $panswer = preg_replace('/[^a-zA-Z0-9]/', '', $panswer); if ( (!empty ($pquestion)) && (!empty ($panswer)) ) { //Update... $updateqa = "UPDATE question SET question=\"$pquestion\", answer=\"$panswer\""; $updateqaresult = mysql_query ($updateqa); echo '<font color="red">Question and Answer has been successfully updated.</font><br /><br />'; } else { echo '<font color="red">Question or Answer is empty.</font><br /><br />'; } } ?> <form action="question.php" method="post"> Question <input type="text" name="question" size="50" maxlength="50" /> <br /> <br /> Answer <input type="text" name="answer" size="20" maxlength="20" /> <br /> <br /> <input type="submit" name="submit" value="Submit" /> </form>
  11. Anyone know where I can find an article management script that people can comment the articles? Something like joomla..but I didn't see anywhere for users to add comments to the articles.
  12. Where does it list the globals for VAR[number]? Couldn't find it at php.net Thanks.
  13. // MEMBERS COOKIE $VAR[4] = ""; can someone explain how var4 works? what does it do when it writes to the cookie? Is $VAR global or the coder have to set what the value is? Thanks in advance.
  14. Is there a way to have a fixed size table? This is my current: [code] <div style="background-color: #8AB3CE; text-align:center; padding-top:5px; padding-bottom:5px;"> <span><b>MY CURRENT TABLE</b></span> <table style="width:100%; height:100%;"> <tr> <td style="font-size:6pt;text-align:right;width:100%;"> IF THIS TEXT WAS ONLY A SENTENCE THEN THE TABLE WILL ONLY EXPAND TO HOW MUCH TEXT THERE IS. </td> </tr> </table> </div> [/code] I'll like to have a fixed table...? Where I can have 1 letter and it'll be the same size as me having 20 sentences. Any clues?
  15. How do I call an array id from another php file? I did the include and $array [id]; Still nothing..? I want to get id [WELCOME_INTRO] to display on another php page. This is the array (array.php): [code] $ar_build = array(         'WELCOME_INTRO' => !$VAR[4] ? get_source("".$VAR[5]."/blah.html") : get_source("".$VAR[5]."/haha.html"),         'ADS' => html_adds(3),         ); [/code] This is part of a phpfile (myphpfile.php) [code] <table style="width:100%;" cellspacing="4" cellpadding="4"> <tr> <td style="font-size:10pt;"> <span style="vertical-align:middle;"><b>LATEST ANNOUNCEMENTS</b></span> <div style="padding:8px;"> <div> <?php echo $ar_build [WELCOME_INTRO]; ?> </div> </div> </td> </tr> </table> (I include the array.php to this php file) [/code] All I want is the stuff on blah.html page to be written where WELCOME_INTRO is.
  16. Cool thanks. Couldn't get the image inside with the link it looks like this: IMAGE [link] All I'm gonna do is match the border with the background color.
  17. I can't seem to align IMAGE with link. I want it to look like this: IMAGE link Ran out of ideas...anyone? I just keep on getting this: IMAGE link [code] <style type="text/css"> table.messagecenter a { width:125px; border:1px solid #333333; display: block; } div.messagecenter a { color: #333333; background: #ffffff; text-decoration:none; font-size:11px; line-height:16px; font-family: Tahoma, verdana, sans-serif; padding: 2px 5px; } div.messagecenter a:link { color: #333333; background: #cccc99; } div.messagecenter a:active { color: #000000; background: #cccc99; } div.messagecenter a:visited { color: #333333; background: #cccc99; } div.messagecenter a:hover { color: #eeeeee; background: #333333; border:1px solid #000000; } </style> <div class="messagecenter"> <table summary="" cellpadding="1" cellspacing="1" class="messagecenter"> <tr> <td>IMAGE linnk</td> </tr> <tr> <td>IMAGE link</td> </tr> <tr> <td>IMAGE link</td> </tr> </table> </div> [/code]
  18. Is there to make a table that's simliar to css's float: left and float: right? I want to make to columns on the page and have a left and right column that I can add bunch of tables on one side and vice versa. Any tutorials?
  19. I have a registration submit form..then after they submit the form it leads to an upload form. How would I add that with the registration form? current upload pictures: [code]<form method="post" action="{%LINK_FORM%}" enctype="multipart/form-data">     <div><input type="hidden" name="step" value="2" /></div>     <div><input type="hidden" name="user" value="{%POST_user%}" /></div>     {%LANG_please_upload%}     <div style="padding-left:20px;padding-top:20px;">          <div style="padding-bottom:6px;">         {%LANG_image%} {%ERROR%}         <div style="padding:4px;">         <input type="file" name="image" size="30" />         </div>     </div>              <div style="padding:10px;">         <input type="submit" value="{%LANG_upload_pic%}" style="cursor:pointer;" />     </div>     </div>     </form>[/code] current submit input from registration. [code] fields fields fields goes down to submit.. <input type="submit" value=" {%lang_submit_form%} " style="cursor:pointer;" /> [/code] Is there a way to add that together so that there will be an upload box as part of the registration form? I've seen it before just don't know how to do it. Maybe add it in the submit input somehow?? Thanks for the help.
  20. I see alot of forms help but nothing on how to add an upload section to the form too. I'll like all the usual name,email, etc but I'll also like for people to be able to upload a picture. Anyone know of any tuturials out there? Thanks.
  21. Is there a way have a div style to just one paragraph without a class? I know the code is not correct, but something along those ines. Something along the lines of: <div style = background-color: blue;> FOR EXAMPLE THIS PARAGRAPH HERE.FOR EXAMPLE THIS PARAGRAPH HERE.FOR EXAMPLE THIS PARAGRAPH HERE.FOR EXAMPLE THIS PARAGRAPH HERE.FOR EXAMPLE THIS PARAGRAPH HERE.FOR EXAMPLE THIS PARAGRAPH HERE.FOR EXAMPLE THIS PARAGRAPH HERE.FOR EXAMPLE THIS PARAGRAPH HERE.FOR EXAMPLE THIS PARAGRAPH HERE.FOR EXAMPLE THIS PARAGRAPH HERE.FOR EXAMPLE THIS PARAGRAPH HERE.FOR EXAMPLE THIS PARAGRAPH HERE. </div> Don't know what it's called but is there a way to have a page separated into 2 vertical sections? I'll like to have a left side where I can do css that won't effect the right side and vice versa. Thanks.
  22. How would I assign values to something like {%TITLE%} ? When I'm finish assigning values to it what extention should I save it as? .tpl? Once that's done all I have to do is include the file and enter {%TITLE%} in my .php file and it'll show what that's assigned to correct? Thanks for the help.
  23. Uhmm.. is {%TITLE%} the same as $TITLE ? Since {%TITLE%} is a variable there should be some file that has something like this: {%TITLE%}="THE WEIRDO"; correct?? Looked at all the html files and didn't see any values that are set to {%TITLE%}. Does it have to be in .html extension or can it be something else too?
×
×
  • 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.