public static function chat_input_form($id = null) { if ($id) { $chat = static::find_by_id($id); $message = $chat->message; $image = ""; if (!empty($chat->img)) { $image .= "<img class='hover_img' style='width:50px; height:50px' "; $image .= "src='"; $image .= $chat->chat_path_and_placeholder(); $image .= "' alt='' >"; } $header_form = "<h4>Edit your message here</h4>"; $submit_value = "Update it"; $submit_name = "submit_edit"; $get = "?id=" . urlencode($id); $form_id = Form::form_id(); } else { $message = ""; $image = ""; $header_form = ""; $submit_value = "Send it"; $submit_name = "submit_new"; $get = ""; $form_id = ""; } $output = ""; $output .= "<div class='row'>"; $output .= "<div class='col-lg-9'>"; $output .= $header_form; $output .= "<div class='chat-message-form'>"; $output .= "<form action='" . static::$page_public; $output .= $get; $output .= "' method='post' enctype='multipart/form-data'>"; $output .= "<div class='form-group'>"; $output .= " <textarea class='summernote form-control message-input' name='message' placeholder='Enter message text'>"; $output .= $message; $output .= "</textarea>"; $output .= "<span class='pull-right' style='margin-right: 50%'>"; $output .= "<input type='file' name='chat_image' id='chat_image' class='form-control' >"; $output .= "</span>"; $output .= "<span > "; $output .= "<input class='btn btn-primary' type='submit' name='"; $output .= $submit_name; $output .= "' value='"; $output .= $submit_value; $output .= "'>"; $output .= " </span>"; if ($id) { $output .= "<span > "; $output .= "<a class='btn btn-info' href='"; $output .= static::$page_public; $output .= "' >"; $output .= "Cancel"; $output .= "</a>"; $output .= " </span>"; $output .= "<span class='pull-right'>"; $output .= $image; $output .= "</span>"; } $output .= $form_id; $output .= csrf_token_tag(); $output .= "</div>"; $output .= "</form>"; $output .= "</div>"; $output .= "</div>"; $output .= "</div>"; return $output; }
<form name="form_client" class="form-horizontal" method="post" action="<?php echo $post_link; ?> "> <fieldset id="login" title="Client"> <legend class="text-center" style="color: #0000ff"><?php echo $page1 . $class_name::$page_name; ?> </legend> <?php echo $class_name::construct_form($get_item); echo Form::form_id(); echo csrf_token_tag(); ?> </fieldset> <div class="col-sm-offset-3 col-sm-7 col-xs-3"> <button type="submit" name="submit" class="btn btn-primary"><?php echo $page . " " . $class_name; ?> </button> </div>
public static function Create_form() { // $is_data=false // if($is_data){ // // $qr_str="?class_name=".get_called_class()."&"; // } else { // $qr_str='?'; // } if (isset($_GET['id'])) { // $post_link=$_SERVER["PHP_SELF"]."?id=".urldecode($_GET['id'].$qr_str); // $post_link=$_SERVER["PHP_SELF"].$qr_str."id=".urldecode($_GET['id']); $post_link = clean_query_string(static::$page_edit . "?id=" . urldecode($_GET['id'])); $page = "Update"; $page1 = "Update "; $text_post = "Updated"; $text_post1 = "update"; } else { $post_link = clean_query_string(static::$page_new); $page = "New"; $page1 = "Add New "; $text_post = "created"; $text_post1 = "creation"; } // var_dump($post_link); // echo "<pre>"; // // print_r($_SERVER['QUERY_STRING']); // echo BR; // print_r($_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']); // echo BR; // print_r($_SERVER); // // echo "</pre>"; $output = ""; $link = "<a href='" . $_SERVER["PHP_SELF"] . " '>" . ' ' . $page1 . "' " . clean_query_string(static::$page_name) . "</a>"; $h4 = "<h4 class='text-center'>{$link} </h4>"; // $output.= $h4; $output .= "<div class =\"background_light_blue\">"; $output .= "<form name='form_ToDo' class='form-horizontal' method='post' action='{$post_link}'> "; $output .= "<fieldset id=\"login\" title=\"Client\"><legend class=\"text-center\" style=\"color: #0000ff\">" . $link . "</legend>"; if (request_is_get()) { if (isset($_GET['id'])) { $id = $_GET['id']; $get_item = static::find_by_id($id); $output .= static::construct_form($get_item, $_GET); } else { $output .= static::construct_form(false, $_GET); } } $output .= Form::form_id(); $output .= csrf_token_tag(); $output .= "</fieldset>"; $output .= " <div class=\"col-sm-offset-3 col-sm-7 col-xs-3\">\n <button type=\"submit\" name=\"submit\" class=\"btn btn-primary\">" . $page . ' ' . get_called_class() . "</button></div>"; $output .= "<div class=\"text-right \" ><a href=\"" . clean_query_string(static::$page_manage) . "\"" . " class=\"btn btn-info \" role=\"button\">Cancel</a></div>"; $output .= ""; $output .= " </form>"; $output .= "</div>"; return $output; }