Form submission adds a
in front of the beginning text in the form

Course Queries Syllabus Queries 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago


Ok, I am using a PHP editing form (previous person built) that submits data into an MSSQL database this works fine however when the information is submitted into the database and later retrieved the the form page (for editing) there is a 
 at the beginning of the text. If the fields start with a 

    that 
     is not inserted. I have been trying to figure out how to stop this. One thing I tried ends up removing all 
     in the text which makes the formatting disappear, How can I keep it from inserting the 
     at the top but keeping the 
     everywhere else? here is the code I have: ( I am giving you everything up to the first field where I have the issue appear)

    function fromhtml ($x) {
      $x = preg_replace("/

    /i","\n\n",$x); //$x = preg_replace("/
    /i","\n",$x);
    $x = preg_replace("/

  • /i","\n
  • ",$x); return $x; } $PHP_SELF = $_SERVER['PHP_SELF']; $course_id = @$_GET["course"]; if ($course_id == "") { $sqlquery = "SELECT id, title, goals, outline, reference, deliverymode, updated2 = CONVERT(VARCHAR(19), updated, 120) FROM courses WHERE division_id = '$division_id' ORDER by id"; $result = mssql_query($sqlquery); $number = mssql_num_rows($result); print "\n"; $i =0;while($number > $i){ $course_id = mssql_result($result,$i,"id"); $reference = mssql_result($result,$i,"reference"); $updated = mssql_result($result,$i,"updated2");print"";}}else{print"Based on $reference";}print"\n";print"\n"; $i++;}print"
    IDTitleStatusLast modified
    "; if ($reference == "") { print "division=$division_id&course=$course_id>$course_id"; } else { print "$course_id"; } print ""; print mssql_result($result,$i,"title"); print ""; if ($reference == "") { if ( (mssql_result($result,$i,"goals")=="") and (mssql_result($result,$i,"outline")=="") ) { print "No syllabus, or incomplete $updated
    "
    ; exit; } $sqlquery = "SELECT * FROM courses WHERE id = '$course_id'"; $result = mssql_query($sqlquery); $number = mssql_num_rows
    0 views
    0 shares
profilepic.png
manpreet 2 years ago

It that BR is at very very nning">beginning of ng">string then use this

$x = preg_replace("/^/i","\n",$x);

instead of that commented ne">line


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.