Jump to content

dropfaith

Members
  • Posts

    1,141
  • Joined

  • Last visited

Everything posted by dropfaith

  1. so i know this is an easy one i just cant recall how or what to search to make it work been a bit since ive coded php right now it does everything needed but im trying to clean up the display a bit the echo line just loops the tr and tds endlessly to the left and right What im going for would be more like this Current Result <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> <td>6</td> <td>7</td> <td>8</td> </tr> Result i need <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> <tr> <td>5</td> <td>6</td> <td>7</td> <td>8</td> </tr> and so on Code below $sql = "SELECT * FROM hashtag"; if($result = mysqli_query($link, $sql)){ if(mysqli_num_rows($result) > 0){ while($row = mysqli_fetch_array($result)){ echo "<td><h1>" . $row['text'] . "</h1><img src=" . $row['link'] . "></td>"; } // Free result set mysqli_free_result($result); } else{ echo "No records matching your query were found."; } } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } right now
  2. that fixed that any way to reverse a foreach.. it displays from twitter so the loop is newest first and cycles thus replacing the newest of the tags otherwise i can just dump the foreach loop and have my bot look thru the script more often thus eliminating its need but adding server strain foreach ($user_timeline as $user_tweet) { if (isset($user_tweet->entities->media)) { $media_url = $user_tweet->entities->media[0]->media_url; $hashtag = preg_replace('^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-‌​\.\?\,\'\/\\\+&%\$#_]*)?$^',' ', $user_tweet->text); } /* Attempt MySQL server connection. Assuming you are running MySQL server with default setting (user 'root' with no password) */ $link = mysqli_connect("localhost", "roguebro", "eruditio2", "roguebro_tweet"); // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } // Attempt insert query execution $sql = "INSERT INTO hashtag (hashtag, link) VALUES ('$hashtag', '$media_url') ON DUPLICATE KEY UPDATE link='" . $media_url . "'"; if(mysqli_query($link, $sql)){ echo "Records inserted successfully."; echo ($sql); echo "<br>"; } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } }
  3. hrmm producing an error in this and i thought i had it ERROR: Could not able to execute (INSERT INTO hashtag (hashtag, link) VALUES ('arena ', 'http://pbs.twimg.com/media/C5QtXQEVUAAyk_-.jpg') ON DUPLICATE KEY UPDATE link='http://pbs.twimg.com/media/C5QtXQEVUAAyk_-.jpg'). You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INSERT INTO hashtag (hashtag, link) VALUES ('arena ', 'http://pbs.twimg.com/med' at line 1 /* Attempt MySQL server connection. Assuming you are running MySQL server with default setting (user 'root' with no password) */ $link = mysqli_connect("localhost", "roguebro", "", "roguebro_tweet"); // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } // Attempt insert query execution $sql = "(INSERT INTO hashtag (hashtag, link) VALUES ('$hashtag', '$media_url') ON DUPLICATE KEY UPDATE link='" . $media_url . "')"; if(mysqli_query($link, $sql)){ echo "Records inserted successfully."; } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } // Close connection mysqli_close($link);
  4. Sorry i did that on no sleep at 5 am basically right now it inserts a new row everytime the script runs which isnt ideal for the end game anymore i changed up my other side to fit it better theres 3 columns Id (auto inc) hashtags and link what i need is if hashtag exists edit link to the new link field there will never be more then 1 link in for each hashtag. i know it has something in here and an update instead of insert but im literally clueless on syntax for it function insertTweets($link,$hashtag){ $mysqli = new mysqli(DBHOST, DBUSERNAME, DBPASSWORD, DBNAME); if ($mysqli->connect_errno) { return 'Failed to connect to Database: (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error; } $prepareStmt='insert INTO '.DBNAME.'.'.TWEETTABLE.' (link,hashtag) VALUES (?,?)'; if ($insert_stmt = $mysqli->prepare($prepareStmt)){ $insert_stmt->bind_param('ss', $link,$hashtag); if (!$insert_stmt->execute()) { $insert_stmt->close(); return 'Tweet Creation cannot be done at this moment.'; }elseif($insert_stmt->affected_rows>0){ $insert_stmt->close(); return 'Tweet Added.<br><br>'; }else{ $insert_stmt->close(); return 'No Tweet were Added.'; } }else{ return 'Prepare failed: (' . $mysqli->errno . ') ' . $mysqli->error; } } ?> Not sure how to check the database to see if hashtag exists then update a different field and if not just insert the full query
  5. Sorry this ends this script i got it doing everything i need except its making too many rows for what i need so i figure an update to it if the hashtag field is already in no idea how to do that i am teaching myself this as i go <?php // Require J7mbo's TwitterAPIExchange library (used to retrive the tweets) // You can get this library from here: https://github.com/J7mbo/twitter-api-php require_once('TwitterAPIExchange.php'); /** database cred **/ define('DBHOST','localhost'); define('DBUSERNAME',''); define('DBPASSWORD',''); define('DBNAME','rogueweet'); define('TWEETTABLE','hashtags'); /** end database cred **/ // Set here your twitter application tokens $settings = array( 'oauth_access_token' => "831981818408677377-FeZYWt3TYwmodmx3gMmFIqx", 'oauth_access_token_secret' => "L1vwbaBjsUivKn56V1lSP5THvjBk3LiadHyOj", 'consumer_key' => "t31OianjdeBAjWPqj3", 'consumer_secret' => "zFZpwpaZl0K1CQPpsagBjVCMkTs2GtWHhRm" ); // Set here the Twitter account from where getting latest tweets $screen_name = 'Dropfaith21'; //username to mock twitter feed // Get timeline using TwitterAPIExchange $url = 'https://api.twitter.com/1.1/statuses/user_timeline.json'; $getfield = "?screen_name={$screen_name}"; $requestMethod = 'GET'; $twitter = new TwitterAPIExchange($settings); $user_timeline = $twitter ->setGetfield($getfield) ->buildOauth($url, $requestMethod) ->performRequest(); $user_timeline = json_decode($user_timeline); foreach ($user_timeline as $user_tweet) { if (isset($user_tweet->entities->media)) { $media_url = $user_tweet->entities->media[0]->media_url; $hashtag = preg_replace('^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-‌​\.\?\,\'\/\\\+&%\$#_]*)?$^',' ', $user_tweet->text); // $hashtag = $user_tweet->text; echo "($hashtag)"; echo "<img src='{$media_url}' width='60%' />"; echo insertTweets($media_url,$hashtag); } } function insertTweets($link,$hashtag){ $mysqli = new mysqli(DBHOST, DBUSERNAME, DBPASSWORD, DBNAME); if ($mysqli->connect_errno) { return 'Failed to connect to Database: (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error; } $prepareStmt='insert INTO '.DBNAME.'.'.TWEETTABLE.' (link,hashtag) VALUES (?,?)'; if ($insert_stmt = $mysqli->prepare($prepareStmt)){ $insert_stmt->bind_param('ss', $link,$hashtag); if (!$insert_stmt->execute()) { $insert_stmt->close(); return 'Tweet Creation cannot be done at this moment.'; }elseif($insert_stmt->affected_rows>0){ $insert_stmt->close(); return 'Tweet Added.<br><br>'; }else{ $insert_stmt->close(); return 'No Tweet were Added.'; } }else{ return 'Prepare failed: (' . $mysqli->errno . ') ' . $mysqli->error; } } ?>
  6. if it helps it inserts a 1 to mysql
  7. so i have the array now but cant do anything database wise. i have 4 hashtag fields and a link one the system i need to use matches array(4) { [0]=> string(19) "#ContestOfChampions" [1]=> string(7) "#Cutoff" [2]=> string(9) "#Dormammu" [3]=> string(11) "#JaneFoster" } is a sample array i would love it if i could somehow insert each field into its own mysql column to make my next steps easier
  8. echo insertTweets($items['user']['name'],$items['user']['screen_name'],$items['text'],$items['created_at'],$items['id_str'],$items['user'] ['followers_count'],$hash); /** FInd hashtags build array **/ preg_match_all("/#(\\w+)/",$items['text'],$hashtags); //now $tags is an array of hashtags /** FInd hashtags build array **/ var_dump( $hashtags); } /** Insert to database **/ function insertTweets($name,$screen_name,$text,$created_at,$id_str,$followers_count,$hash){ $mysqli = new mysqli(DBHOST, DBUSERNAME, DBPASSWORD, DBNAME); if ($mysqli->connect_errno) { return 'Failed to connect to Database: (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error; } $prepareStmt='INSERT INTO '.DBNAME.'.'.TWEETTABLE.' (name, screen_name, text, created_at, id_str, followers_count, hashtags) VALUES (?,?,?,?,?,?,?)'; if ($insert_stmt = $mysqli->prepare($prepareStmt)){ $insert_stmt->bind_param('sssssid', $name,$screen_name,$text,$created_at,$id_str,$followers_count,$hash); if (!$insert_stmt->execute()) { $insert_stmt->close(); return 'Tweet Creation cannot be done at this moment.'; }elseif($insert_stmt->affected_rows>0){ $insert_stmt->close(); return 'Tweet Added.<br>'; }else{ $insert_stmt->close(); return 'No Tweet were Added.'; } }else{ return 'Prepare failed: (' . $mysqli->errno . ') ' . $mysqli->error; } }
  9. So i got this pulling twitter data raw i cant for the life of me figure out how to explode items $text(tweet body and seperate the hashtags and enter them into a database (database hase 3 fields for hashtags) <?php /** database cred **/ define('DBHOST','localhost'); define('DBUSERNAME','***'); define('DBPASSWORD','**'); define('DBNAME','roguebro_tweet'); define('TWEETTABLE','twitter'); /** end database cred **/ /** Set access tokens here - see: https://dev.twitter.com/apps/ **/ require_once('TwitterAPIExchange.php'); $settings = array( 'oauth_access_token' => "831981818408677377-FexWOmvCyaZYWt3TYwmodmx3gMmFIqx", 'oauth_access_token_secret' => "L1vwbaBjsUivKn5NYVmGgve6V1lSP5THvjBk3LiadHyOj", 'consumer_key' => "t31OianjtopHhDEdeBAjWPqj3", 'consumer_secret' => "zFZpwrMl31BShY6CluYapaZl0K1CQPpsagBjVCMkTs2GtWHhRm" ); /** end Twitter Credentials **/ $url = "https://api.twitter.com/1.1/statuses/user_timeline.json"; $requestMethod = "GET"; $getfield = '?screen_name=MCoCTrucos&entities=on&count=20 -rt'; $twitter = new TwitterAPIExchange($settings); $string = json_decode($twitter->setGetfield($getfield) ->buildOauth($url, $requestMethod) ->performRequest(),$assoc = TRUE); if($string["errors"][0]["message"] != "") {echo "<h3>Sorry, there was a problem.</h3><p>Twitter returned the following error message:</p><p> <em>".$string[errors][0]["message"]."</em></p>";exit();} foreach($string as $items) { echo "Tweeted by: ". $items['user']['name']."<br />"; echo "Screen name: ". $items['user']['screen_name']."<br />"; echo "Tweet: ". $items['text']."<br />"; echo "Time and Date of Tweet: ".$items['created_at']."<br />"; echo "Tweet ID: ".$items['id_str']."<br />"; echo "Followers: ". $items['user']['followers_count']."<br /><hr />"; echo insertTweets($items['user']['name'],$items['user']['screen_name'],$items['text'],$items['created_at'],$items['id_str'],$items['user']['followers_count']); $tags = $items['text']; $hashtags = explode("#", $tags); } function insertTweets($name,$screen_name,$text,$created_at,$id_str,$followers_count){ $mysqli = new mysqli(DBHOST, DBUSERNAME, DBPASSWORD, DBNAME); if ($mysqli->connect_errno) { return 'Failed to connect to Database: (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error; } $prepareStmt='INSERT INTO '.DBNAME.'.'.TWEETTABLE.' (name, screen_name, text, created_at, id_str, followers_count) VALUES (?,?,?,?,?,?);'; if ($insert_stmt = $mysqli->prepare($prepareStmt)){ $insert_stmt->bind_param('ssssid', $name,$screen_name,$text,$created_at,$id_str,$followers_count); if (!$insert_stmt->execute()) { $insert_stmt->close(); return 'Tweet Creation cannot be done at this moment.'; }elseif($insert_stmt->affected_rows>0){ $insert_stmt->close(); return 'Tweet Added.<br><br>'; }else{ $insert_stmt->close(); return 'No Tweet were Added.'; } }else{ return 'Prepare failed: (' . $mysqli->errno . ') ' . $mysqli->error; } } ?>
  10. So i got the basis of this working here http://www.roguebrother.x10host.com/tweet.php what im trying to do is make it so it searches by not only username(complete) but also a certain hashtag (Duels) And get it to display any media (photos) in said tweet <?php require_once('TwitterAPIExchange.php'); /** Set access tokens here - see: https://dev.twitter.com/apps/ **/ $settings = array( 'oauth_access_token' => "831981818408677377-FexWOmvCyaZYWt3TYwmodmx3gMmFIqx", 'oauth_access_token_secret' => "L1vwbaBjsUivKn5NYVmGgve6V1lSP5THvjBk3LiadHyOj", 'consumer_key' => "t31OianjtopHhDEdeBAjWPqj3", 'consumer_secret' => "zFZpwrMl31BShY6CluYapaZl0K1CQPpsagBjVCMkTs2GtWHhRm" ); $url = "https://api.twitter.com/1.1/statuses/user_timeline.json"; $requestMethod = "GET"; $getfield = 'screen_name=MCoCTrucos&count=1'; $twitter = new TwitterAPIExchange($settings); $string = json_decode($twitter->setGetfield($getfield) ->buildOauth($url, $requestMethod) ->performRequest(),$assoc = TRUE); if($string["errors"][0]["message"] != "") {echo "<h3>Sorry, there was a problem.</h3><p>Twitter returned the following error message:</p><p> <em>".$string[errors][0]["message"]."</em></p>";exit();} foreach($string as $items) { echo "Tweeted by: ". $items['user']['name']."<br />"; echo "Screen name: ". $items['user']['screen_name']."<br />"; echo "Tweet: ". $items['text']."<br />"; echo "Time and Date of Tweet: ".$items['created_at']."<br />"; echo "Tweet ID: ".$items['id_str']."<br />"; echo "Followers: ". $items['user']['followers_count']."<br /><hr />"; } { echo $url;} ?>
  11. this below is the idiot error it submits everything except baby into my database just fine baby = select box like all the others html is fine <?php $gender = $_POST['gender']; $gender1 = $_POST['gender1']; $Species1 = $_POST['Species1']; $Species2 = $_POST['Species2']; $baby = $_Post['baby']; $query="insert into breeding (gender, gender1, Species1, Species2, baby) values ('$gender','$gender1','$Species1','$Species2','$baby')"; $result = mysql_query($query); ?> Okay now for the question the code below im trying to add a counter to it but all the fields need to match so anytime all gender 1 and 2 species 1 and 2 baby match it adds to a counter and displays but only if they all match. Im not sure where to start on that so tips are awesome or instruction since im new to this <?php $query = "SELECT * FROM breeding"; $result = mysql_query($query); if (mysql_num_rows($result) > 0) { // iterate through resultset // print article titles while($row = mysql_fetch_object($result)) { ?> <tr> <td><?php echo $row->gender; ?> <?php echo $row->Species1; ?></td> <td><?php echo $row->gender1; ?> <?php echo $row->Species2; ?></td> <td><?php echo $row->baby; ?></td> <td>HERE ID LIKE TO ECHO TOTAL </td> </tr> <?php } } // if no records present // display message else { ?> <p>No press releases currently available</p> <?php } ?> http://box1.host1free.com/~crimso/breeding.php theres a test link
  12. Relevant Links http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/treasure/xml http://box1.host1free.com/~crimso/index.php (right side My Treasure section) <?php function getPagetreasure($url="http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/treasure/xml"){ $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_FRESH_CONNECT,TRUE); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5); curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE); curl_setopt($ch,CURLOPT_REFERER,'http://www.treasuretrooper.com/'); curl_setopt($ch,CURLOPT_TIMEOUT,10); $xmltreasure=curl_exec($ch); if($xmltreasure==false){ $m=curl_error(($ch)); error_log($m); } curl_close($ch); return $xmltreasure; } $xmlfiletreasure = getPagetreasure("http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/treasure/xml"); $treasure =new SimpleXMLElement($xmlfiletreasure); $resultst = array(); foreach ($treasure as $ttreasure){ $resultst[] = $ttreasure; } print_r($resultst); ?> I have it printing the array so you guys can see whats in it.. What im trying to do is build a simple 2 column table ie <table> <tr> <td class="label">Offer Due</td> <td>DATA FROM ARRAY HERE.</td> </tr> </table> i wont be using all the data in the array on this project prob like 4 items total Offer_Due, Total_Due,Total_Paid and maybe a few more as time goes on im clueless as to where to go from where my php is to where i need it to go at this point
  13. I wont lie i legit have no idea what your talking about on that lol. Im pretty much teaching myself this as i go i dont use php ever.. Started like last night ish
  14. Warning: array_reverse() [function.array-reverse]: The argument should be an array in /home/crimso/domains/crimsontrauma.com/public_html/template/rightnav.php on line 38
  15. ehh other then reversing it im good now i think im still way off on the direction i should have gone tho <?php function getPage($url="http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/approved/xml"){ $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_FRESH_CONNECT,TRUE); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5); curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE); curl_setopt($ch,CURLOPT_REFERER,'http://www.treasuretrooper.com/'); curl_setopt($ch,CURLOPT_TIMEOUT,10); $xml=curl_exec($ch); if($xml==false){ $m=curl_error(($ch)); error_log($m); } curl_close($ch); return $xml; } $xmlfile = getPage("http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/approved/xml"); $approved =new SimpleXMLElement($xmlfile); $i = 0; echo <<<EOF <h2>Approving Now</h2> <ul> EOF; foreach($approved as $approve) // loop through our Offers { $i++; echo <<<EOF <li>{$result->Name}</li> EOF; if($i >= 15) break; } echo <<<EOF </ul> EOF; ?>
  16. Okay So ive never had to build an array from an external source xml document So excuse this question. I tried the code below Got an array but as you can imagine the entire file flags as key 0. Where as i need it to seperate the items if i plot to limit and reverse its direction. <?php $xmlfile = getPage("http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/approved/xml"); $xmlf = array("$xmlfile"); print_r(array_reverse($xmlf)); foreach($xmlf as $Item => $Name) { echo $Item . " " . $Name . "<br>"; }?>
  17. yes display the info the other way right now im just echoing xml ie the entire feed until i logic out a better way to handle this
  18. All i need now is to reverse the feed and cut it to like 20 posts. http://box1.host1free.com/~crimso/index.php this link is my live test i have the xml set in the way i want it looking but i cant for the life of me reverse and limit it <?php function getPage($url="http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/approved/xml"){ $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_FRESH_CONNECT,TRUE); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5); curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE); curl_setopt($ch,CURLOPT_REFERER,'http://www.treasuretrooper.com/'); curl_setopt($ch,CURLOPT_TIMEOUT,10); $xml=curl_exec($ch); if($xml==false){ $m=curl_error(($ch)); error_log($m); } curl_close($ch); return $xml; } $xml=getPage("http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/approved/xml"); echo $xml; ?>
  19. sigh okay i cleared up all those issues but im running into an issue with something small due to being forced to use curl im clueless on progress as i just learned it i removed $html=htmlentities($html); Started styling it(im good on that now) BUt im having issues reversing its order right now its oldest date to newest. I have a date field Approved_On to work with that all has info in it. Also working on limiting the number of results to like 30 max . Again im dumb on this right now. So anything helps
  20. Lets start with what i have working http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/approved/xml pull that xml file (no style) http://box1.host1free.com/~crimso/ is my current page as you see the xml file over in approved now (right side) <?php function getPage($url="http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/approved/xml"){ $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_FRESH_CONNECT,TRUE); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,5); curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE); curl_setopt($ch,CURLOPT_REFERER,'http://www.treasuretrooper.com/'); curl_setopt($ch,CURLOPT_TIMEOUT,10); $html=curl_exec($ch); if($html==false){ $m=curl_error(($ch)); error_log($m); } curl_close($ch); return $html; } $html=getPage("http://www.treasuretrooper.com/api/116fcbdb1cac242e789a892ebd2a0abb/approved/xml"); $html=htmlentities($html); echo $html; ?> I just need t get the xml styled properly and im clueless as to how id do it with the curl function involved. So any direction would help tons on this. Also wondering why its showing the actual xml code tree i assumed it would only provide the information
  21. okay its 4am but this should get you going the right way this makes a 3 div layout style one all left and then 2 on top of eachother like your top image was <style> .filler {float:left;} .rightside {float:right;width:1001px;} .header {width:1000px;height:200px;} .content {width:1000px;} </style> <div class="filler">ggewgw </div> <div class="rightside"> <div class="header"> gsd </div> <div class="content"> sfdgsdgsg </div> </div>
  22. for things that are repeated like posts i wouldnt use an ID i would use a class. http://cssfreakie.blogspot.com/2011/04/class-ids-and-selectors-rocket-science.html will probably explain it better then i will tho
  23. i know css pretty well but just managed to get a interview for a web design job was looking for a quick refresher of css i could read thru tonight and kinda sudy up on it a bit more anyone got any ideas?
  24. just a quick type up so may want to check it a bit form code below <form id="myform" class="cssform" action=""> <p> <label for="user">Name</label> <input type="text" id="user" value="" /> </p> <p> <label for="emailaddress">Email Address:</label> <input type="text" id="emailaddress" value="" /> </p> <p> <label for="comments">Feedback:</label> <textarea id="comments" rows="5" cols="25"></textarea> </p> <p> <label for="comments">Sex:</label> Male: <input type="radio" name="sex" /> Female: <input type="radio" name="sex" /><br /> </p> <p> <label for="comments">Hobbies:</label> <input type="checkbox" name="hobby" /> Tennis<br /> <input type="checkbox" name="hobby" class="threepxfix" /> Reading <br /> <input type="checkbox" name="hobby" class="threepxfix" /> Basketball <br /> </p> <p> <label for="terms">Agree to Terms?</label> <input type="checkbox" id="terms" class="boxes" /> </p> <div style="margin-left: 150px;"> <input type="submit" value="Submit" /> <input type="reset" value="reset" /> </div> </form> then a basic css to align it (pretty basic looking form here) .cssform p{ width: 300px; clear: left; margin: 0; padding: 5px 0 8px 0; padding-left: 155px; /*width of left column containing the label elements*/ border-top: 1px dashed gray; height: 1%; } .cssform label{ font-weight: bold; float: left; margin-left: -155px; /*width of left column*/ width: 150px; /*width of labels. Should be smaller than left column (155px) to create some right margin*/ } .cssform input[type="text"]{ /*width of text boxes. IE6 does not understand this attribute*/ width: 180px; } .cssform textarea{ width: 250px; height: 150px; } /*.threepxfix class below: Targets IE6- ONLY. Adds 3 pixel indent for multi-line form contents. to account for 3 pixel bug: http://www.positioniseverything.net/explorer/threepxtest.html */ * html .threepxfix{ margin-left: 3px; }
×
×
  • 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.