Friday 15 April 2011

html - Having an that enters to a php variable -



html - Having an <inputbox> that enters to a php variable -

ok have inputbox , trying create when set lets title in box adds variable called $title , have $title in title tags

<form id="curse-form" class="nm" action="title.php" method="post" accept-charset="utf-8"> <div id="loading" style="display: none" class='alert'> <a class='close' data-dismiss='alert'>×</a> loading </div> <div id="response"></div> <div class="content_form"> <input type="text" name="title" class="input-large" placeholder="change title" value="<?php echo htmlspecialchars($title); ?>" /> <button class="btn btn-large btn-primary" type="submit"><i class="icon-edit"></i>change title</button> </div> </form>

no thought if doing right form tags in title.php have php tags $title=; sure thats not how done

i not using database not sure if needed... can jsut store title in global variable? or improve utilize database

why not submit form?

$title = (isset($_post['title']) && !empty($_post['title']) ? $_post['title'] : '');

which equivalent to

if(isset($_post['title']) && !empty($_post['title'])){ $title = $_post['title']; } else{ $title = ''; } $_session['page_title'] = $title;

then on html

<title><?php echo $_session['page_title'];?></title>

php html mysql

No comments:

Post a Comment