squiblo
Members-
Posts
483 -
Joined
-
Last visited
-
Days Won
2
Everything posted by squiblo
-
A user posts some data into the database using <textarea>, but if there is a line break in the data that they enter, it uses this "<br />" how can i stop it from posting "<br />" and get it to post "<br>" instead. Thanks
-
Thanks nightslyr, you've saved me alot of time
-
i have tried using lots of different tags, and they all seem to work, so why is it that only <br /> does not work?
-
any help please?
-
Thanks little guy I did not notice that mistake but it still does not work, does anybody understand why?
-
go to... www.squiblo.com/test.php to understand my problem
-
go to... www.squiblo.com/test.php to see my full problem
-
if each user uploads there own image then you could concatinate there userid with there file name as each userid will be unique
-
slight change of plan..... please visit this link and explain why the user has to click "edit" twise before the text changes, if i can resolve this, i believe i could solve my problem above. www.squiblo.com/test.php thanks
-
<?php $about_me_query = mysql_query("SELECT * FROM page_set_data WHERE username='$username'"); while ($row = mysql_fetch_assoc($about_me_query)) { $about_me = $row['about_me']; } if (!$about_me) { $about_me = ""; $nothing = "Write about yourself"; } ?> <script type="text/javascript"> function toggle_visibility(id) { var div = document.getElementById(id); var text = document.getElementById("about_me_text"); if(div.style.display == 'block' ) { div.style.display = 'none'; text.innerHTML = "<?php echo $nothing.$about_me; ?>"; } else { div.style.display = 'block'; text.innerHTML = "<?php echo $about_error; ?><form action='' method='POST'><textarea cols='23' rows='6' name='textarea_about' id='textarea_about' style='font-family:arial;font-size:13px;overflow:hidden'><?php echo "$about_me";?></textarea><br><input type='submit' name='submit_about' value='Save'> <input type='button' name='cancel_about' value='Cancel' onClick=\"window.location.href='content.php?content=myhub&myhub=mypage&mypage=mypage&cont=<?php echo $cont; ?>'\"></form>"; } } </script> Whenever the variable name "$about_me" has any tags in it, the following like does not work... <a href='#' onclick="toggle_visibility('about_me_popup');"><font color='CornflowerBlue'>Edit</font></a> What am i doing wrong? Thanks
-
sorry guy, ive just done it AT LAST!
-
I have some data in a database (about_me). When there is no data in "about_me", everything works fine and the user can upload data but when data is put in by the user, and the user then wants to edit it again, it doesnt work. This is the php to upload the data <!-- about me upload --> <?php if (isset($_POST['submit_about'])) { if (isset($_POST['textarea_about'])) { $textarea_about = nl2br($_POST['textarea_about']); if (strlen($textarea_about) < 301) { mysql_query("UPDATE page_set_data SET about_me='$textarea_about' WHERE username='$username'"); header("location:http://www.squiblo.com/content.php?content=myhub&myhub=mypage&mypage=mypage&cont=$cont"); } else $about_error = "<ul><li>About you have as maximum of 300 characters.</li></ul>"; } } ?> This gets the data from the database and puts it into variable <?php $about_me_query = mysql_query("SELECT * FROM page_set_data WHERE username='$username'"); while ($row = mysql_fetch_assoc($about_me_query)) { $about_me = nl2br($row['about_me']); } if (!$about_me) { $about_me = "Write about yourself"; } ?> This is the javascript to change from showing the data in textarea or not <script type="text/javascript"> function toggle_visibility(id) { var div = document.getElementById(id); var text = document.getElementById("about_me_text"); if(div.style.display == 'block' ) { div.style.display = 'none'; text.innerHTML = "<?php echo $about_me; ?>"; } else { div.style.display = 'block'; text.innerHTML = "<?php echo $about_error; ?><form action='' method='POST'><textarea cols='23' rows='6' name='textarea_about' id='textarea_about' style='font-family:arial;font-size:13px;overflow:hidden'><?php echo nl2br($about_me);?></textarea><br><input type='submit' name='submit_about' value='Save'> <input type='button' name='cancel_about' value='Cancel' onClick=\"window.location.href='content.php?content=myhub&myhub=mypage&mypage=mypage&cont=<?php echo $cont; ?>'\"></form>"; } } </script> And finaly here is some HTML <div id='about_me_text'> <?php echo $about_me; ?> </div> <div id='about_me_popup' style="display:none"> </div> If you are finding it hard to understand me, please say so and ill link you to the page. Or i you know how to do this and please could you show me a better way for doing this. thanks
-
Thank you everyone!
-
The following function only works for the variable "$forname" how can i get it to also work for $surname and $city function validCharacters($input) { //Returns true if all the characters are letters (upper and lower case) return (preg_match("/[^\w]/", $input)==0); } //Usage if (!validCharacters($forname)+($surname)+($city)) { echo "All boxes can only contain letters"; } else { echo "success"; }
-
what exactly will that function do, because i need an else saying something like, "You can only use letters"
-
If a user enters data into an input field, i do not want them to be able to upload special characreters like the following or numbers: "- #'][{}£$%^&*()â▀♣ and many more from character map. how can i do this, by checking a variable like... $username = $_POST['username']; Thanks.
-
Even though the input fields do not have any spaces in them, my if statement below always echoes "No boxes allow spaces". I was wondering if i have set up the if statement correctly, thanks. <?php if ((substr_count($forname, ' '))&&(substr_count($surname, ' '))&&(substr_count($city, ' ')) < 1) { echo "success"; } else echo "No boxes allow spaces"; ?>
-
an easier way of putting it, how can i merge these 2 queries into 1... mysql_query("SELECT * FROM table WHERE user_id='$user_id' AND friend=1"); and mysql_query("SELECT * FROM table WHERE other_person_id='$user_id' AND friend=1"); and then my aim is to echo out the the row that doesnt have $user_id in it NOTE: $user_id will never been the same in both rows
-
Thank, but i also what to select all from where other_person_id = '$user_id'
-
You mean something like this? <?php $query = mysql_query("SELECT * FROM date_table"); while ($row = mysql_fetch_assoc($query)) { $day = $row['day']; $month = $row['month']; $year = $row['year']; } echo $day ."/". $month ."/". $year ."<br />".; ?>
-
forget that previous post, thats just be being stupid once again...i think i ment this... mysql_query("SELECT * FROM table_name WHERE user_id='$user_id' OR page_zebra_id='$user_id' AND friend=1"); i have tried this but it only give me data from 1 row
-
i came up with this, but im not sure... SELECT * FROM user_id AND page_zebra WHERE user_id='$user_id' AND page_zebra='$user_id'
-
I guess it would be a little like this with a few changes... mysql_query("SELECT * FROM user_id AND other_person_id WHERE user_id='$user_id' AND other_person_id='$user_id'");
-
I have never attempted mysql like this before...this is what the table looks like.. || user_id || other_person_id || friend || foe || 2 44 1 0 34 2 1 0 What i want to do is this.... say that the $_SESSION['user_id'] == 2 and $user_id = $SESSION['user_id']; Without doing 2 queries how can I pick put all the people that are friends with $user_id?