Jump to content

jwwceo

Members
  • Posts

    212
  • Joined

  • Last visited

Everything posted by jwwceo

  1. I just built a series of pulldowns to send data to my homepage. It works fine...but I also have affiliates who link to my site...and their links go first to another directory and then forwarded to my home page. I want to offer my affiliates the chance to put these pulldowns on their site to increase their sales. When I point the "action" part of the form to the affiliate url, I need the form values from the pulldowns to automatically get passed through to my home page where they can be read. But heres the tricky, part. I can't see the affiliate code because it's encoded in base 64... I decoded it, but it's still pretty cryptic code...uses all their own functions and things. So I want to build a script that will catch the post data and then forward it on to the the next page without interfering with the affiliate script. Is this possible. It all needs to happen automatically...
  2. Check out this page...[url=http://www.liquidcotton.com]www.liquidcotton.com [/url] there is a roll over menu on each item...the javascript I used uses absolute positioning from the top left, so I need to figure out the top and left values for each keyword icon and tell the menus to start there... I know where the first menu goes, as well as how far between them...so I should be able to figure out the top and left values for every shirt on a page...
  3. I am having a hard time wrapping my head around the logic fort this problem. It's probably super easy but I'm new at this so I'm not sure if I'm going in the right direction... I need to find the row and column number for every image in a product gallery. what's the best way to do this.. I know I can start with a while loop for every item in the database...and... $row = 0; $column = 0; and increment based on some if statements..but the exact syntax is evading me.. any help would be great!
  4. I am trying to insert a variable directly into a line of HTML, with no spaces... the line of code I've got looks like this: [code] $selectedshirtid = $info['shirt_id']; echo "<DIV class=menuContainer id=menu'$selectedshirtid'Container>[/code] but this outputs <DIV class=menuContainer id=menu'3'Container> It's not supposed  have the single quote around the variable...should look like this... <DIV class=menuContainer id=menu3Container> if I just put the php variable on it's own with no quotes..it doesn't read at all... Also- can php be used in the HTML header? I can't think of why it wouldn't be able to...but for some reason I remember reading that it can't...
  5. I may not be using that foreach right. The idea is that I store all the keywords and their keyword id's that apply to a shirt in an array called $keywords. Then for each item in the array I output another row in the table... would a while loop be better????
  6. I  am trying to make a product page that will create custom javascript menus for each item on the page. There will be a little icon that once rolled over will make a pop up menu with the keywords for that shirt. The javascript menu I'm using has a block of HTML in the body for each menu. The following code is what I've came up with to build these HTML tables for each menu. I only posted the relevant code...I think.... I think once I get his part done I can get the rest.... I get major parse errors... any ideas....is the logic even right??? [code] //CREATES A LOOP THAT OUTPUTS THE FOLLOWING HTML FOR EACH ROW IN THE DATABASE while($info = mysql_fetch_array($data)){ //PULLS THE KEYWORD DATA FOR EACH ITEM(ROW) $data1 = mysql_query("SELECT * FROM shirtkeywords WHERE shirt_id ='".$info['shirt_id']."') or die(mysql_error()); $keywords = mysql_fetch_array( $data1 )); //BUILD THE JAVASCRIPT HEADER  FOR EACH MENU "<DIV class=menuContainer id=menu$info[shirt_id]Container> <DIV class=menu id=menu$info[shirt_id]Content> <DIV class=menuInsert style='HEIGHT: 180px'> <TABLE class=menuTable cellSpacing=0 cellPadding=0 border=0> <TBODY>"; //BUILD THE TABLE ROWS FOR EACH KEYWORD ASSOCIATED WITH A PRODUCT foreach ($keywords[] as $keyword_id) { echo "<TR>     <TD><IMG height=4 src='menu_script/spacer.gif' width=1></TD></TD>   <TR>     <TD><A class=menuLink href='link'>".keywords['keyword']."</A></TD></TR>     </TBODY> </TABLE></DIV></DIV></DIV>"; } [/code]
  7. I will put my page online and post again in a few hours...
  8. Hello, I designed this little php page to add edit or delete colors(table 1) and keywords( table 2) to or from a databse a database. The color and keywords are then assigned to shirts in a third and fourth table. I just added dumped my databse to to do some testing and when I add in data to the color and keyword tables using this page for some reason they don't show up where they are supposed to be listed unless I refresh my page. But when I refesh sometimes it will add a duplicate entry to my database. I know there is some wierdness going on...but I'm not good enough at this yet to nail it down... any glaring problems...Thanks in advance!!!! JW [code]<html> <link href="style.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" type="text/css" href="ds.css"> <head> <title>LiquidCotton.com Admin - Add Edit Delete Colors/Keywords</title> </head> <body bgcolor="#FFFFFF"> <a href='admin.php'><img src='images/logo.gif' border='0'></a><br> <p><b>ADD EDIT OR DELETE COLORS AND KEYWORDS</b></p> <?php include 'library/config.php'; include 'library/opendb.php'; error_reporting(0); if(isset($_POST['keyupdate'])) { $keyword_id=$_POST['keyword_id']; $newkeyword=$_POST['newkeyword'];   $query="UPDATE keywords SET keyword='$newkeyword' WHERE keyword_id ='$keyword_id'";   $result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query); } elseif(isset($_POST['keydelete'])) { $keyword_id=$_POST['keyword_id'];   $query = "DELETE from keywords WHERE keyword_id='$keyword_id'";   $result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);   mysql_query("DELETE FROM shirtkeywords WHERE keyword_id = '$keyword_id'") or die (mysql_query()); } if(isset($_POST['update'])) { $color_id=$_POST['color_id']; $newcolor=$_POST['newcolor'];   $query="UPDATE colors SET color='$newcolor' WHERE color_id ='$color_id'";   $result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query); } elseif(isset($_POST['delete'])) { $color_id=$_POST['color_id'];   $query = "DELETE from colors WHERE color_id='$color_id'";   $result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);   mysql_query("DELETE FROM shirtcolors WHERE color_id = '$color_id'") or die (mysql_query()); } if(isset($_POST['submitcolor'])) {   $color=$_POST['color'];   $query="INSERT INTO colors (color)  VALUES ('$color')";     $result = mysql_query($query) or die("Eror: ". mysql_error(). " with query ". $query);     } elseif (isset($_POST['submitkeyword'])) {   $keyword=$_POST['keyword'];   $query="INSERT INTO keywords (keyword)  VALUES ('$keyword')";     $result = mysql_query($query) or die("Eror: ". mysql_error(). " with query ". $query);     } echo "<form method='post' action='addcf.php']'> <TABLE> <TR>   <TD><INPUT TYPE='text' NAME='color' class='cartForm'  size=30></TD>   <td align='left'><INPUT TYPE='submit' name='submitcolor' class='cartForm'  value='Add this Color' size='30'></td> </TR> <TR>   <TD><INPUT TYPE='TEXT' NAME='keyword' class='cartForm'  size=30></TD>   <td align='left'><INPUT TYPE='submit' name='submitkeyword' class='cartForm'  value='Add this Keyword' size='30'></td> </TR> <tr><td colspan='2'><hr></td></tr> <tr><td colspan='2'> <table> <tr><td valign='top'> <table> <tr><td colspan='3' align='center' width=150><b>COLORS</b></td></tr>"; $data = mysql_query('SELECT * FROM colors ORDER BY color ASC') or die(mysql_error()); $info = mysql_fetch_array( $data ); while($info = mysql_fetch_array( $data )) { echo "<form method='post' action =\"$PHP_SELF\"> <tr><td><input type=text name ='newcolor' class='cartForm' value='".$info['color']."' size='15'></td> <td><input type='submit' class='cartForm' name='update' value='update'></td> <td><input type='submit' class='cartForm' name='delete' value='delete'></td>     <input type='hidden' name ='color_id' value='".$info['color_id']."' </tr> </form>"; } echo "</table> </td> <td valign='top'><table> <tr><td colspan='3' align='center' width=150><b>KEYWORDS</b></td></tr>"; $keydata = mysql_query('SELECT * FROM keywords ORDER BY keyword ASC') or die(mysql_error()); $keyinfo = mysql_fetch_array( $keydata ); while($keyinfo = mysql_fetch_array( $keydata )) { echo "<form method='post' action =\"$PHP_SELF\"> <tr><td><input type=text name ='newkeyword' class='cartForm' value='".$keyinfo['keyword']."' size='15'></td> <td><input type='submit' class='cartForm' name='keyupdate' value='update'></td> <td><input type='submit' class='cartForm' name='keydelete' value='delete'></td>     <input type='hidden' name ='keyword_id' value='".$keyinfo['keyword_id']."' </tr> </form>"; } echo "</table> </td> </tr> </table> </tr> </TABLE> </form>"; ?> </body> </html>[/code]
  9. I already have a Style sheet applied...will this style sheet overide the other one for containers of the same type.... how do you make sure that for items like <html> or <p> the right style sheet is being used...
  10. I like the last menu...thanks..1 question.... This may sound stupid..but I don't want to jarble up my <head> with all that css and script data.. can I make one big php file to echo the whole thing and just plop it into my header...and just include the php file.... JW
  11. The menus are supposed to pop up when a link is hovered on, not just change color.... can this be done with CSS??? sorry for not being clear...
  12. I have a databse with three tables. shirts, colors, and shirtcolors. Shirtcolors has 2 fields for the primary keys for both shirts and colors, linking up shirts and what colors thet come in... my customers are going to be selecting a color from a pulldown and I want to have a search results page display all the shirts that have that color... I have never pulled data from 2 tables before...what's the best way to do this????
  13. I want to add some javascript rollover menus to my php pages. But the javascript menu items will be pulled from my MySQL databse. I usually have a seperate .js file which I link in at the top of my HTML... but if this seperate document is a php doc (that outputs javascript) will this still work.. what's the best way to go about this????
  14. I have 3 tables in my databse...shirts, colors, and shirtcolor. The third table, shirtcolor, has just 2 columns; the shirt_id from shirts and color_id from colors. Whenever I delete a shirt I also want to delete all the rows from shirtcolor where there is a row with the same shirt_id. Likewise, if I delete a color I want all references to it in shirtcolor to be deleted as well.... Do I need to set up foreign keys in my third table or can I just make the delete queries on my own manually. if I can do them manually what is the point of the foreign keys? if I assigna foreign key, will the related rows be deleted automatically???
  15. Thank you Liam! You have been very helpful on this part of my project...arrays are still a little confusing and I don't know that many commands to work with them...you've shown me some cool things!!! thanks! James
  16. So I finally got my checkboxes working to where I can add them to a databse, and have the correct checkboxes already "checked" on the edit page when a user comes in the make changes... however, what kind of query do I use to update any changes in the checkboxes...there might be as many as 50 boxes... say theres 20 boxes currently checked and the user checks 10 more....an UPDATE query only updates current rows...in this case I'd need to update 20 and add 10....plus all the rows will have the same shirt_id since all the checkboxes relate to the same product.... does this make sense...
  17. Nice. That worked awesome...THANKS!!! any tips on how to write a little code for the edit page which will see if the color values should be checked already or not...I can't seem to get my head around this....been working too long...
  18. I am making my first php mySQL project and I'm at the toughest part...I'm a little confused where to even start on this part... my project has t-shirts being held in a databse. One of the tables in the database is just for all the colors that various shirts come in. Many shirts come in lots of different colors. So I have created a third table with just 2 fields (shirt_id and color_id) that will match the shirts with all the different colors thay come in... However, on my page for adding a t-shirt to the database I would like to have all the available colors listed with checkboxes so when I add the shirt I can also click on all the colors they come in and submit everything at the same time... can this be done at the same time???....it seems like if I haven't added the shirt first then there won't be a shirt_id to be added to the joined third table. Does this make sense...
  19. Sorry if this sounds naive. I 'm a total newbie... but how you get the value of whatever they typed into the text box if they haven't submitted it yet..... under this design there is no additional update.php page...it needs to be updated from the link alone... Ive attached my code to see if this makes it <?php include 'library/config.php'; include 'library/opendb.php'; error_reporting(0); $color_id = $_GET['color_id']; if($_GET['cmd']=='delete'){ $query = "DELETE from colors WHERE color_id='$color_id'"; $result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query); } // [b][color=red][font=Verdana]THIS IS WHERE I'M CONFUSED[/font][/color][/b] //if($_GET['cmd']=='update'){ // //$query="UPDATE colors SET color='$color', WHERE color ='$color_id'"; //$result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query); //} if(isset($_POST['submitcolor'])) {   $color=$_POST['color'];   $query="INSERT INTO colors (color)  VALUES ('$color')";     $result = mysql_query($query) or die("Eror: ". mysql_error(). " with query ". $query);     } elseif (isset($_POST['submitkeyword'])) {   $keyword=$_POST['keyword'];   $query="INSERT INTO keywords (keyword)  VALUES ('$keyword')";     $result = mysql_query($query) or die("Eror: ". mysql_error(). " with query ". $query);     echo "     <p>Your keyword has been added!</p>"; } echo "<form method='post' action='addcf.php']'> <TABLE> <TR>   <TD><INPUT TYPE='text' NAME='color' class='cartForm'  size=30></TD>   <td><INPUT TYPE='submit' name='submitcolor' class='cartForm'  value='Add this Color' size='30'></td> </TR> <TR>   <TD><INPUT TYPE='TEXT' NAME='keyword' class='cartForm'  size=30></TD>   <td><INPUT TYPE='submit' name='submitkeyword' class='cartForm'  value='Add this Keyword' size='30'></td> </TR> <tr><td colspan='2'><hr></td></tr> <tr><td colspan='2'> <table> <tr><td> <table> <tr><td colspan='3' align='center' width=150><b>COLORS</b></td></tr>"; $data = mysql_query('SELECT * FROM colors') or die(mysql_error()); $info = mysql_fetch_array( $data ); while($info = mysql_fetch_array( $data )) { echo "<form> <tr><td><input type=text class='cartForm' value='".$info['color']."' size='15'></td> <td><a href='addcf.php?color_id=".$info['color_id']."&cmd=update'>Edit</a></td> <td><a href='addcf.php?color_id=".$info['color_id']."&cmd=delete'>Delete</a></td> </tr> </form>"; } echo "</table> </td> </tr> </table> </tr> </TABLE> </form>"; ?> </body> </html>
  20. I got the delete one done...the update is a little trickier for me.... what if you don't know what you value is gonna be until the link is clicked... For example, I have a text box where users can update a field...usually I would just use the sumbit button and _get to find out what they typed...but there is no submit button or method=get...theres just a text link that says update....
  21. First off, this board is awesome. Thanks for all the help... I have a simple question.... how can I make a link act like a form control. For example, i want to delete an item from the database, but instead of using a submit button, I'd like to just have a text link that says delete that does the same thing. JW
  22. Yes. I didn't know that text needed to be in a container to have style sheets apply to it..I threw it in a <p> and it works fine. Thanks!!!!
  23. <html> <link href="style.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" type="text/css" href="ds.css"> <head> <title>LiquidCotton.com Admin - Edit/Delete Shirt</title> </head> <body bgcolor="#FFFFFF"> <?php include 'library/config.php'; include 'library/opendb.php'; error_reporting(0); $shirt_id = $_GET['shirt_id']; if(isset($_POST['delete'])) { $query = "DELETE from shirts WHERE shirt_id='$shirt_id'"; $result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);     echo " <a href='admin.php'><img src='images/logo.gif' border='0'></a><br><br>     Your shirt has been deleted!"; } elseif(isset($_POST['submit'])) {   $name=$_POST['name'];   $comment=$_POST['comment'];   $link=$_POST['link'];   $site=$_POST['site'];   $image=$_POST['image'];   $active=$_POST['active'];   $commission=$_POST['commission'];   $query="UPDATE shirts SET name='$name', comment='$comment', link='$link', site ='$site',   image ='$image', active ='$active', commission ='$commission' WHERE shirt_id ='$shirt_id'";   $result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);     echo     "<a href='admin.php'><img src='images/logo.gif' border='0'></a>     <br><br>Your shirt has been updated!"; } else { $data = mysql_query("SELECT * FROM shirts WHERE shirt_id ='$shirt_id'") or die(mysql_error()); $info = mysql_fetch_array( $data ); echo "<a href='admin.php'><img src='images/logo.gif' border='0'></a><br> <form method='post' action='edit.php?shirt_id=$shirt_id'> <TABLE> <TR>   <TD>Name:</TD>   <TD><INPUT TYPE='TEXT' NAME='name'  size=50 value='".$info['name']."'></TD> </TR> <TR>   <TD>Comment</TD>   <TD><textarea rows='5' cols='50' name='comment'>".$info['comment']."</textarea> </TD> </TR> <TR>   <TD>Link</TD>   <TD><INPUT TYPE='TEXT' NAME='link'  size=50 value='".$info['link']."'></TD> </TR> <TR>   <TD>Site</TD>   <TD><INPUT TYPE='TEXT' NAME='site'  size=50 value='".$info['site']."'></TD> </TR> <TR>   <TD>Image</TD>   <TD><INPUT TYPE='TEXT' NAME='image'  size=50 value='".$info['image']."'></TD> </TR> <TR>   <TD>Active</TD>"; if($info['image'] == 'true') { echo   "<TD><input type='radio' name='active' value='true' CHECKED> Active <br> <input type='radio' name='active' value='false'> Inactive   </TD>";   }   else {   echo "<TD><input type='radio' name='active' value='true' > Active <br> <input type='radio' name='active' value='false' CHECKED> Inactive   </TD>";   } echo "</TR> <TR>   <TD>Commission</TD>   <TD><INPUT TYPE='TEXT' NAME='commission' size=50 value='".$info['commission']."'></TD> </TR> <TR>   <TD></TD>   <TD><INPUT TYPE='submit' name='submit' value='Edit this Tee'>       <INPUT TYPE='submit' name='delete' value=' Delete this Tee'></TD> </TR> </TABLE> </form>"; } ?> </body> </html>
  24. I have some text at the end of my code that allows the user to know that they have succesfully added or deleted or edited a file in MySQL. They say things like "product added" or "product updated". For some reason this text does not adhere to the style sheets I'm using on all the pages. Anyone experience this before???
  25. I just posted a few minutes ago about a GET problem...It turns out that is wasn't a problem, just a warning...It is actually working fine...but my code is still not working... the following snippet is supposed to update or delete a row in a MySQL database.... when I press either submit or delete I get the correct response, that is, is says "your shirt has been deleted", but nothing actually happens in the database... any ideas.... Thanks!!! <?php include 'library/config.php'; include 'library/opendb.php'; error_reporting(0); $shirt_id = $_GET['shirt_id']; if(isset($_POST['delete'])) { $query = "DELETE from shirts WHERE shirt_id='$shirt_id'"; mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);     echo "Your shirt has been deleted!"; } elseif(isset($_POST['submit'])) {   $name=$_POST['name'];   $comment=$_POST['comment'];   $link=$_POST['link'];   $site=$_POST['site'];   $image=$_POST['image'];   $active=$_POST['active'];   $commission=$_POST['commission'];   $query="UPDATE shirts SET name='$name', comment='$comment', link='$link', site ='$site',   image ='$image', active ='$active', commission ='$commission' WHERE shirt_id ='$shirt_id'";   mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);     echo "Your shirt has been updated!"; } else { $data = mysql_query("SELECT * FROM shirts WHERE shirt_id ='$shirt_id'") or die(mysql_error()); $info = mysql_fetch_array( $data ); echo "<a href='admin.php'><img src='images/logo.gif' border='0'></a><br> <form method='post' action='edit.php'> <TABLE> <TR>   <TD>Name:</TD>   <TD><INPUT TYPE='TEXT' NAME='name'  size=50 value='".$info['name']."'></TD> </TR> <TR>   <TD>Comment</TD>   <TD><textarea rows='5' cols='50' name='comment'>".$info['comment']."</textarea> </TD> </TR> <TR>   <TD>Link</TD>   <TD><INPUT TYPE='TEXT' NAME='link'  size=50 value='".$info['link']."'></TD> </TR> <TR>   <TD>Site</TD>   <TD><INPUT TYPE='TEXT' NAME='site'  size=50 value='".$info['site']."'></TD> </TR> <TR>   <TD>Image</TD>   <TD><INPUT TYPE='TEXT' NAME='image'  size=50 value='".$info['image']."'></TD> </TR> <TR>   <TD>Active</TD>"; if($info['image'] == 'true') { echo   "<TD><input type='radio' name='active' value='true' CHECKED> Active <br> <input type='radio' name='active' value='false'> Inactive   </TD>";   }   else {   echo "<TD><input type='radio' name='active' value='true' > Active <br> <input type='radio' name='active' value='false' CHECKED> Inactive   </TD>";   } echo "</TR> <TR>   <TD>Commission</TD>   <TD><INPUT TYPE='TEXT' NAME='commission' size=50 value='".$info['commission']."'></TD> </TR> <TR>   <TD></TD>   <TD><INPUT TYPE='submit' name='submit' value='Edit this Tee'>       <INPUT TYPE='submit' name='delete' value=' Delete this Tee'></TD> </TR> </TABLE> </form>"; } ?> </body> </html>
×
×
  • 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.