MadTechie Posted March 13, 2008 Share Posted March 13, 2008 //add this line to the start then do a submit print_r($_POST); if(isset($_POST['submit']) && isset($_POST['user']) && isset($_POST['user2']))//updated { //snip you see array ([user2] = "balr" etc post that back Quote Link to comment https://forums.phpfreaks.com/topic/95713-insert-html-code-into-sql-table-via-php-form/page/3/#findComment-491306 Share on other sites More sharing options...
Alexhoward Posted March 13, 2008 Author Share Posted March 13, 2008 you want me to post this back...?  <?php Array (   [user] => alexhoward   [user2] => <a href="http://www.dpbolvw.net/click-2804964-10394636" target="_blank" onmouseover="window.status='http://www.argos.co.uk';return true;" onmouseout="window.status=' ';return true;"><img src="http://www.lduhtrp.net/image-2804964-10394636" width="120" height="60" alt="Argos" border="0"/></a> ) ?>  sorry i had to do it from the page source, as it comes up as a image link on the page Quote Link to comment https://forums.phpfreaks.com/topic/95713-insert-html-code-into-sql-table-via-php-form/page/3/#findComment-491313 Share on other sites More sharing options...
MadTechie Posted March 13, 2008 Share Posted March 13, 2008 ok remove the isset($_POST['submit']) && if(isset($_POST['user']) && isset($_POST['user2']))//updated { Quote Link to comment https://forums.phpfreaks.com/topic/95713-insert-html-code-into-sql-table-via-php-form/page/3/#findComment-491316 Share on other sites More sharing options...
Alexhoward Posted March 13, 2008 Author Share Posted March 13, 2008 Nice one!! Â mate, you are a super Guru!! Quote Link to comment https://forums.phpfreaks.com/topic/95713-insert-html-code-into-sql-table-via-php-form/page/3/#findComment-491322 Share on other sites More sharing options...
MadTechie Posted March 13, 2008 Share Posted March 13, 2008 i'll take that as its working:) Â Quote Link to comment https://forums.phpfreaks.com/topic/95713-insert-html-code-into-sql-table-via-php-form/page/3/#findComment-491331 Share on other sites More sharing options...
Alexhoward Posted March 13, 2008 Author Share Posted March 13, 2008 Yea it works a treat!  when i get home tonight i'll put it all on the correct pages, and link them up properly.  i'm at work at the moment, and doing this through my servers online ftp, and editor.  working with txt is rubbish (no nice colours )  I feel rude to keep asking you questions,  but this is the last one for this section  promise.  the script that arranges them in the grid, puts them all next to each other, and i'd like to spread them out a bit.  and draw a box aroung them withrounded corners (obviously i'll get rid of the table border, and i take it that this will be a graphic i'll have to insert)  I've tried messing with the usual table funtions but can't get it how i'd like.  basically the grid will be 4 x 3, or 3 x 3 haven't decided yet, see what looks best,  and i'd like them to be evenly sized and apart from one another. not all tight next to each other...  see what i mean?  Cheers for all this  really appreciate it Quote Link to comment https://forums.phpfreaks.com/topic/95713-insert-html-code-into-sql-table-via-php-form/page/3/#findComment-491342 Share on other sites More sharing options...
MadTechie Posted March 13, 2008 Share Posted March 13, 2008 as i said this is a HTML/CSS issule not really php one, you may wany to look into CSS later (but i think its better yet a little harder), you can style the tables ie  <table width="100%" border="0" cellspacing="5" cellpadding="10">  <tr>   <td width="25%">add</td>   <td width="25%">add</td>   <td width="25%">add</td>   <td width="25%">add</td>  </tr>  <tr>   <td width="25%">add</td>   <td width="25%">add</td>   <td width="25%">add</td>   <td width="25%">add</td>  </tr>  <tr>   <td width="25%">add</td>   <td width="25%">add</td>   <td width="25%">add</td>   <td width="25%">add</td>  </tr> </table>  Quote Link to comment https://forums.phpfreaks.com/topic/95713-insert-html-code-into-sql-table-via-php-form/page/3/#findComment-491355 Share on other sites More sharing options...
Alexhoward Posted March 13, 2008 Author Share Posted March 13, 2008 Can i just do it as a style thou,  as it's not really a table, not a static one anyway,  it's being made due to the amount of links  <?php } $mysite_username = $_COOKIE["mysite_username"]; $conn = mysql_connect($server, $db_user, $db_pass) or die ("could not connect to mysql"); #Connect to mysql $rs = mysql_select_db( $database, $conn ) or die ("Could not select database"); #select database $sql = "Select link FROM links"; //pull the users from the table $result= mysql_query($sql) or die(" Could not add style facts"); echo "<table align=center border=1>";    // display the users in table $c = 0; while($row = mysql_fetch_array($result)) {  $user2 = htmlspecialchars($row['link'], ENT_QUOTES);  $user3 = $row['link'];  //$user2 = $row['link'];  if($c%5 == 0) echo "<tr height=\"200px\">"; // If the counter has ticked 6 times, start a new row. $sql2 = "SELECT link FROM memberlinks WHERE username = '$mysite_username' and link = '$user2'"; $result2 = mysql_query($sql2) or die(" Could not add style facts"); //$qry2 = mysql_query($result2) //or die ("Could not match data because ".mysql_error()); $num_rows = mysql_num_rows($result2); if ($num_rows != 0) { //if(empty($result2)) //{ $button = "Link Added"; }else{ $button = "<input type='submit' value='Add Link'>"; } //<input type=submit> //UPDATEED: removed the action (action='addlinks.php') as we call ourself echo "<td><FORM method='post'><p><input type=HIDDEN name='user' value='$mysite_username'></p><p align=center><input type=HIDDEN name='user2' value='$user2'></p><p align=center>$user3</p><p align=center>rating script here</p><p align=center>$button</p></form>";  if($c%5 == 4) echo "</tr>"; // If we're drawing the 5th pic, end this row.  $c++; } if($c%5 != 4) echo "</tr>"; // If there isn't a number of pics divisible by 6, end the row echo "</table>"; // end the table ?>  know this has got difficult to look at Quote Link to comment https://forums.phpfreaks.com/topic/95713-insert-html-code-into-sql-table-via-php-form/page/3/#findComment-491364 Share on other sites More sharing options...
MadTechie Posted March 13, 2008 Share Posted March 13, 2008 i don't think height will work on a <tr> tag, maybe line height, but to sumup yes you can use styles Quote Link to comment https://forums.phpfreaks.com/topic/95713-insert-html-code-into-sql-table-via-php-form/page/3/#findComment-491454 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.