Jump to content

gathos

Members
  • Posts

    38
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

gathos's Achievements

Member

Member (2/5)

0

Reputation

  1. I'm trying to build a social media bookmarker like socialmarker.com- a page that will load sites like reddit, technoratti, and such, in an iframe and auto populate the required fields with what i have filled in already outside of the iframe. now to my question: is there a way to auto populate fields inside an iframe with php? thats the language i'm most familiar with. if not what language would be the easiest to implement this? i know i could just use socialmarker.com, but there are a few bugs that i don't like in it, plus i want to expand my knowledge - see how far i can reach. thanks ahead of time, gathos.
  2. thanks fo the code help, apparently i forgot the ad an s my table name it was sample instead of samples. $result = mysql_query($sql) or die(mysql_error());
  3. thanks for the qick reply, i efited the message to include my proble, lol.
  4. hey guys, I'm looking for the error in my code. I can't seem to find it. anyways the situation is, i have a gallery database, i have my form setup to give each image a name and description. hit submit and then the it supposed to update the database with the description. heres my code for my form page editrec.php: <form id="form1" name="form1" method="post" action="processeditrec.php"> <?php $id = $_GET["id"]; $name = $_GET["name"]; $page = $_GET['page']; mysql_connect("localhost", "username*****", "password****") or die(mysql_error()); mysql_select_db("database*****") or die(mysql_error()); $result = mysql_query("SELECT * FROM samples WHERE id='$id'") or die(mysql_error()); $row = mysql_fetch_array( $result ); $oldname = $row['name']; $oldfilename = $row['filename']; $oldsdesc = $row['sdesc']; $oldldesc = $row['ldesc']; ?> <input name="passid" type="hidden" id="passid" value="<? echo $id; ?>" /> <? function strip_ext($name) { $ext = strrchr($name, '.'); if($ext !== false) { $name = substr($name, 0, -strlen($ext)); } return $name; }; $remove_exts = strip_ext($oldfilename); ?> <input name="page" type="hidden" id="page" value="<? echo $page ?>" /> <br /> <table width="100%" border="0"> <tr> <td width="20%" rowspan="2"><img src="images/<? echo $oldfilename; ?>" alt="" height="100" /></td> <td width="26%">name: <input name="name" type="text" id="name" value="<? echo $remove_exts ?>" class="textfield" /></td> <td>Short Description: <input type="text" name="sdesc" id="sdesc" value="<? echo $oldsdesc; ?>"/></td> </tr> <tr> <td colspan="2" align="left" valign="top"><p>Description:<br /> <textarea name="ldesc" id="ldesc" cols="45" rows="5"><? echo $oldldesc; ?></textarea> <br /> </p></td> </tr> </table> <br /> <table width="100%" border="0"> <tr> <td> </td> <td> </td> </tr> </table> <br /> <table width="100%" border="0"> <tr> <td width="25%" align="left" valign="top"> </td> <td width="25%" align="left" valign="top"> </td> <td width="25%" align="left" valign="top"> </td> <td width="25%" align="left" valign="top"> </td> </tr> </table> <label> <input type="submit" name="submit" id="submit" value="Submit" /> </label> </p> </form> heres my code for my processing page processeditrec.php: <? $name = $_POST['name']; $sdesc = $_POST['sdesc']; $ldesc = $_POST['ldesc']; $id = $_POST['passid']; $obscurity = $_POST['obscurity']; $page = $_POST['page']; mysql_connect("localhost", "username*****", "password*****") or die(mysql_error()); mysql_select_db("database*****") or die(mysql_error()); $sql = " UPDATE sample SET name= '$name', sdesc= '$sdesc', ldesc= '$ldesc', obscurity= '$obscurity' WHERE id = '$id'"; $result = mysql_query($sql); if ($result){ echo "Your record was updated!<br/>"; } else { echo "An error occured during update!<br/>"; } ?> <html> <head> </head> <br> <a href="displayrec.php">Click here to go to the gallery.</a> </html> i can't figure out what is going on. it's probably something simple but, well i can't find it. It won't update the databse with the new info, and on the process page i get " an error occured during the update" but i have no idea how to get it to give me more information. thanks for your help, gathos.
  5. Ok so here's the deal, what I'm looking for is generalization not specific scripting. my boss wants to do a commission based setup for his online sales that i have generated though blogs and other such means. but the propblem i'm having is that we don't have a shopping cart as we are custom stained glass, we have a system that the customer chooses a design they like, give us there sizes and we send them a email quote that was generated by a person. since the affiliate programs i have seen are based for instant shopping cart sales, not custom sales that are different for every customer, and sent through emails. does anyone know of something i might be able to download or maybe some ideas of how i might be able to make some myself, and an idea of how to get to that point. IE: i thought of tracking ip addresses, then putting them in a database if the customer goes throught and actually sends a quote, it would copy it and add that to the database. how do other affiliate programs work? Thanks for your help, and i hope i made sense. gathos.
  6. alright i mad e it work but ... not well... my array looks like this: Array ( [1] => rectangle [2] => cabinet [3] => geometric [4] => bevel [5] => border ) > my code looks like this: <? //turn the string into a array $s = $keywords; $words = split("[ ]+", $s); ?> <? // remove the first empty entry in the array. $i=0; foreach ($words as &$transfer){ if ($i >= 1){$keytra[$i] = $transfer;}; $i++; }; ?> <? //set checkers to 0 $square = 0; $rectangle = 0; $circle = 0; $curvetop = 0; $octagon = 0; $oval = 0; $rake = 0; //check array, see if there is a value that equals any of the checkboxes of this set. foreach ($keytra as &$value) { if (($value == "square")&&($square !=1)){echo '<input name="keywords[]" type="checkbox" id="square" value="square" checked="checked"/> Square <br />'; $square=1;} elseif (($value != "square")&&($square !=1)){echo '<input name="keywords[]" type="checkbox" id="square" value="square" /> Square <br />'; $square=1;} }; foreach ($keytra as &$value) { if (($value == "rectangle")&&($rectangle !=1)){echo '<input name="keywords[]" type="checkbox" id="rectangle" value="rectangle" checked="checked"/> rectangle <br />'; $rectangle=1;} elseif (($value != "rectangle")&&($rectangle !=1)){echo '<input name="keywords[]" type="checkbox" id="rectangle" value="rectangle" /> rectangle <br />'; $rectangle=1;} }; foreach ($keytra as &$value) { if (($value == "circle")&&($circle !=1)){echo '<input name="keywords[]" type="checkbox" id="circle" value="circle" checked="checked"/> circle <br />'; $circle=1;} elseif (($value != "circle")&&($circle !=1)){echo '<input name="keywords[]" type="checkbox" id="circle" value="circle" /> circle <br />'; $circle=1;} }; foreach ($keytra as &$value) { if (($value == "curvetop")&&($curvetop !=1)){echo '<input name="keywords[]" type="checkbox" id="curvetop" value="curvetop" checked="checked"/> curvetop <br />'; $curvetop=1;} elseif (($value != "curvetop")&&($curvetop !=1)){echo '<input name="keywords[]" type="checkbox" id="curvetop" value="curvetop" /> curvetop <br />'; $curvetop=1;} }; foreach ($keytra as &$value) { if (($value == "octagon")&&($octagon !=1)){echo '<input name="keywords[]" type="checkbox" id="octagon" value="octagon" checked="checked"/> octagon <br />'; $octagon=1;} elseif (($value != "octagon")&&($octagon !=1)){echo '<input name="keywords[]" type="checkbox" id="octagon" value="octagon" /> octagon <br />'; $octagon=1;} }; foreach ($keytra as &$value) { if (($value == "oval")&&($oval !=1)){echo '<input name="keywords[]" type="checkbox" id="oval" value="oval" checked="checked"/> oval <br />'; $oval=1;} elseif (($value != "oval")&&($oval !=1)){echo '<input name="keywords[]" type="checkbox" id="oval" value="oval" /> oval <br />'; $oval=1;} }; ?> it works for this section of checkboxes however in the next set it no longer fills out the check boxes that should be listed. this is the code for the next section <? ///now check the next set. $cabinet = 0; $door = 0; $panel = 0; $transom = 0; $sidelite= 0; $ceiling= 0; $skylight= 0; $divider= 0; $sign= 0; foreach ($keytra as &$value) { if (($value == "cabinet")&&($cabinet !=1)){echo '<input name="keywords[]" type="checkbox" id="cabinet" value="cabinet" checked="checked"/> cabinet <br />'; $cabinet=1;} elseif (($value != "cabinet")&&($cabinet !=1)){echo '<input name="keywords[]" type="checkbox" id="cabinet" value="cabinet" /> cabinet <br />'; $cabinet=1;} }; foreach ($keytra as &$value) { if (($value == "door")&&($door !=1)){echo '<input name="keywords[]" type="checkbox" id="door" value="door" checked="checked"/> door <br />'; $door=1;} elseif (($value != "door")&&($door !=1)){echo '<input name="keywords[]" type="checkbox" id="door" value="door" /> door <br />'; $door=1;} }; foreach ($keytra as &$value) { if (($value == "panel")&&($panel !=1)){echo '<input name="keywords[]" type="checkbox" id="panel" value="panel" checked="checked"/> panel <br />'; $panel=1;} elseif (($value != "panel")&&($panel !=1)){echo '<input name="keywords[]" type="checkbox" id="panel" value="panel" /> panel <br />'; $panel=1;} }; foreach ($keytra as &$value) { if (($value == "transom")&&($transom !=1)){echo '<input name="keywords[]" type="checkbox" id="transom" value="transom" checked="checked"/> transom <br />'; $transom=1;} elseif (($value != "transom")&&($transom !=1)){echo '<input name="keywords[]" type="checkbox" id="transom" value="transom" /> transom <br />'; $transom=1;} }; foreach ($keytra as &$value) { if (($value == "sidelite")&&($sidelite !=1)){echo '<input name="keywords[]" type="checkbox" id="sidelite" value="sidelite" checked="checked"/> side lite <br />'; $sidelite=1;} elseif (($value != "sidelite")&&($sidelite !=1)){echo '<input name="keywords[]" type="checkbox" id="sidelite" value="sidelite" /> side lite <br />'; $sidelite=1;} }; foreach ($keytra as &$value) { if (($value == "ceiling")&&($ceiling !=1)){echo '<input name="keywords[]" type="checkbox" id="ceiling" value="ceiling" checked="checked"/> ceiling <br />'; $ceiling=1;} elseif (($value != "ceiling")&&($ceiling !=1)){echo '<input name="keywords[]" type="checkbox" id="ceiling" value="ceiling" /> ceiling <br />'; $ceiling=1;} }; foreach ($keytra as &$value) { if (($value == "skylight")&&($skylight !=1)){echo '<input name="keywords[]" type="checkbox" id="skylight" value="skylight" checked="checked"/> skylight <br />'; $skylight=1;} elseif (($value != "skylight")&&($skylight !=1)){echo '<input name="keywords[]" type="checkbox" id="skylight" value="skylight" /> skylight <br />'; $skylight=1;} }; foreach ($keytra as &$value) { if (($value == "divider")&&($divider !=1)){echo '<input name="keywords[]" type="checkbox" id="divider" value="divider" checked="checked"/> divider <br />'; $divider=1;} elseif (($value != "divider")&&($divider !=1)){echo '<input name="keywords[]" type="checkbox" id="divider" value="divider" /> divider <br />'; $divider=1;} }; foreach ($keytra as &$value) { if (($value == "sign")&&($sign !=1)){echo '<input name="keywords[]" type="checkbox" id="sign" value="sign" checked="checked"/> sign <br />'; $sign=1;} elseif (($value != "sign")&&($sign !=1)){echo '<input name="keywords[]" type="checkbox" id="sign" value="sign" /> sign <br />'; $sign=1;} }; ?> There should be a checkbox in the cabinet checkbox, but there isn't. i hope someone can see the error i made because i can't find it. thanks again, phil.
  7. ok so what i want to do is have a page with 30 checkboxes on it, and save those to a database, however i don't want to have 30 different variables on the database. what i've done so far is to take teh checkboxes and add tehm to an array, and then turn it into one big string, then save the string. however if i go back to the page where the check boxes are, the checkboxes are empty (obviously). so then i split the strring back into an array when i load the page. i've tried something like this, foreach ($words as &$value) { if ($value == "square")){echo '<input name="keywords[]" type="checkbox" id="square" value="square" checked="checked"/> Square'; $square=1;} elseif ($value == "square"){echo '<input name="keywords[]" type="checkbox" id="square" value="square" /> Square'; $square=1;} }; but the output is outs out a checkbox on EVERY variable so instead of just 30 checkboxes i end up with 30 * however many words are in the string. so my question is, can you guys give me some suggestions on how to fill in the checkboxes when i open the page? I really hope i made sense, it's was hard for me to describe. thanks in advance. phil
  8. that's awsome i've been looking for something like this for a while, thank you.
  9. ok so i have a page to add inputs into a database like description, it's a textfield, so i can type description like this: blah blah blah blah blah but when i echo it i get: blah blah blah blah blah how can i get it so that i get to display the same way i entered it? ie: blah blah blah blah blah later days gathos
  10. yeah the desc was the problem. when you mentioned it, i remembered that i had the same problem 6 months ago, and i completely forgot that it was a reserved word. thank you very much. later days, gathos
  11. ok so i have a database setup and running, i have the correct username and password. and all variables can be echoed and they are correct. every time i try to add a new entry to the database it says "An error occured during insert!" i made it say that when the data would not enter, but i can't see WHY it's not entering. please help, i am so confused as to why this isn't working <?php $_COOKIE['cookiename']; $pass = $_COOKIE['cookiename']; $name = $_POST['name']; $sdesc = $_POST['sdesc']; $desc = $_POST['desc']; if ($pass == mypassword) { mysql_connect("localhost", "username", "mypassword") or die(mysql_error()); mysql_select_db("imgdb") or die(mysql_error()); $sql = "INSERT INTO img (name, sdesc, desc) VALUES ('$name', '$sdesc', '$desc')"; $result = mysql_query($sql); if ($result) { echo "Your entry was added to the database!<br/>"; } else { echo "An error occured during insert!<br/>"; } } else { echo 'sorry you have not entered the correct password to access the databse <br> please go back to the <a href="login.php">login page</a>'; }; ?> i am really confused, please help
  12. I mocked up this code, hopefully it will help, even though it's not a direct answer. <html> <head> <title>Untitled Document</title> </head> <body> <form method='post'> <?php $width = $_POST["width"]; $height = $_POST["height"]; ?> <br /> <br /> Width: <input type='text' name='width' /> <br /> X <br /> Height : <input type='text' name='height' /> <br /> <input type='submit' name='submit' value='Calculate' /> <br /> <br /> answer: <? if(!empty($_POST)){ $total = $width * $height; echo $total; }; // to make sure not to display anything until you input a number ?> </form> </body> </html> later days, gathos
  13. ok i didn't actually look through all of the code, but ngreenwood6 had a good point the multiple else can cause problems. If you need these try using a switch: <?php switch ($i) { case "apple": echo "i is apple"; break; case "bar": echo "i is bar"; break; case "cake": echo "i is cake"; break; } ?> If that doesn't help check out the manual http://ca3.php.net/switch They can explain a switch better then I ever could.
  14. hehe i just posted something similar, what is happening is that your variables are strings, so it's adding two strings together, not numbers. a way that i was to to fix it was price = +price + +delivery; it turns them from a string into a integer. i hope this helped.
  15. I don't know if this will help you but i just did up a select option and to access the value that was selected i usedsomething sililar like: var selected_percent = document.getElementById('courseMaintance).value that way i access the value directly, i don't know if it's needed or not, but it works. later days, gathos
×
×
  • 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.