I have the following screen in my project.Everthing is working fine other than the redirection link of View.As you can see it is poping up the validation error.I have no idea why its comming.Even,I am redirecting to diffrent model.
I want to go the diffrent page when clicking View.
I have the following code in my view.
//codes//
<div class="view" id="id">
<?php
echo "<h4>Name : " . $value['name']. "</h4>";
echo "<h4>Skills : " . $value['key_skills'] . "</h4>";
echo "<h4>Category : " . $value['title']. "</h4>";
echo "<h4>Experience : " . $value['experience'] . " Years.</h4>";
// echo CHtml::submitButton('View Details', array('name' => 'viewemployeedetails'));
echo CHtml::button('View',array(
'submit'=>array('SiteContoller/actionViewEmployeeDetails',array('id'=>$value['id'])),
));
?>
</div>
I have tried few things...but its not working.
You have to remove the 'Controller' text part and 'action' text part from:
'SiteContoller/actionViewEmployeeDetails'
and use
'site/viewEmployeeDetails'
if you want it to go to SiteController's actionViewEmployeeDetails action
You should use CHtml::link not CHtml::button unless you are posting data to the address. You can use css to style your link to look and visually behave like a button. In addition there is no submit attribute for button see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button
Related
I have the following code:
if (!empty($row['skype'])) {
echo "<b>Skype:</b> " . $row['skype'] . " Chat";
}
Unfortunately, this does not display as hyperlink on my website. If I change it to:
if (!empty($row['skype'])) {
echo "<b>Skype:</b> " . $row['skype'] . " Chat";
}
The link is displayed, but it is broken - it leads to www.domain.com/%22skype:venci?chat%22
I have other hrefs in my page like:
echo "<b>E-Mail:</b> " . $row['email'] . "<br />";
and these are displayed correctly, so I'm wondering.. Why is this not working?
I found the issue. It lies within the popover component in bootstrap. Thanks to all guys!
It looks like the popover does not support all href types :)
So I am using the code that I got off W3C here: http://www.w3schools.com/php/php_ajax_database.asp
modified it to fit with my file names and database etc, however I am having a weird issue with echoing my responses to look correct.
For every product that collects from the product database it needs to print it in a section tag like so:
while($row = $result->fetch_assoc())
{
echo "<section class='sideWays'>" . $row['product_ID'] . " " . $row['product_name'] . " " . $row['description'] . " " . "<div class='colHeaderImageRight'>" . '<img src="'.$row['image'].'"">' . "</div>" . "</section>";
}
However this code isn't working anymore, the closest I have gotten is it to only display one and then breaks the rest.
the PHP echo is being returned into the following div tag
<article>
<div id="txtHint"><b>Person info will be listed here...</b></div>
</article>
so I have tried changing my CSS to stuff like article > .txtHint > #sideWays or even just making the #sideWays css the same as .txtHint to skip the > #sideWays but nothing is working to display my CSS on the echo.
I'm not sure why but changing the keyword echo to print fixed the issue of it not recognising my html tags and applying the CSS to them.
I want my hyperlinks destination to be filled by a value from my database. However, when I click the link in my app it doesn't clear the "http://localhost/videoStorageApp/" before inserting the URl value from the database.
QUESTION: How do I clear the web browser url so only the URL value form the database is used?
WHAT I AM GETTING: http://localhost/videoStorageApp/'www.sonsofanarchy.tv'
WHAT I WANT: www.sonsofanarchy.tv
CODE:
This is the line that displays the hyperlink in question, if more code is needed please ask and ill add anything else that's needed:
echo '<td> ' . $row['url'] . '</td>';
echo '<td> ' . $row['url'] . '</td>';
You are probably missing "http://" in your href attribute.
<a href="google.com">
... will take you to http://currentsite.com/maybe-a-subfolder/google.com
<a href="http://google.com">
... will take you to http://google.com
I have multiple forms in a PHP file that I call with the 'include' command. If I put the include command before the other forms in the HTML page then it works. The problem is that I need to call the 'include' command below the other forms. The solution I came up with was to call the PHP file at the beginning of the page and hide the div. I then called the file again at the bottom of the page which fixed the problem. Is there another solution? Why is it doing this?
Non working example:
<form></form>
<form></form>
include 'phpfilewithotherforms.php';
working example but not viable:
include 'phpfilewithotherforms.php';
<form></form>
<form></form>
working example:
<div style="display:none;">include 'phpfilewithotherforms,php';</div>
<form></form>
<form></form>
include 'phpfilewithotherforms.php';
Sample of PHP file that I'm calling:
while($row = mysql_fetch_array($result))
{
echo "<div style='padding:20px;margin:15px;background:offwhite;border-style:solid;border-width:1px;border-color:lightgray;'>" .
"<form method='post' name='example'>" .
"<span class='detail'><b>Title:</b> " .
$row['mytitle'] .
" " .
"<input type='hidden' value='" . stripslashes($row['mytitle']) . "' . name='title'>" .
"<span style='float:right'>" .
"<input type='submit' value='Edit' name='edit'>" .
"<input type='submit' value='Preview' name='preview'>" .
"</span>" .
"</form>" .
}
You have to work in order. I would split the included file in two, one with the code needed before forms, and the other with the code needed after forms.
I usually write PHP inside HTML with <? PHP CODE ?>
<div style="display:none;"><?include 'phpfilewithotherforms,php';?></div>
Are you missing those?
For my actual web-project, I made a tagcloud. When I click on a tag, it should be passed to the page showRecipesFromTags.php.
<form name="tagform" id="tagform" method="get" action="/showRecipesFromTags.php">
<?php
include('php/getRandomTags.php');
$tagsarr = json_decode($return4634, true);
foreach ($tagsarr['Data']['Tag'] as $key => $tag11) {
echo '<a id="seastags" href="#" onclick="document.tagform.submit()"><font size="' . rand(1,4) .'">' . $tag11['Tag_name'] . '</font> <br/></a> ';
}
?>
</form>
It can already go to this page by clicking on the href, but what I need is to pass the id of the clicked tag. The name of the tag is called Tag_name. The name is shown but I donĀ“t know how the pass the id to the next site. The id is in my JSON array and is called Tag_id.
How can I manage this?
Why do you even need a form? Just use plain links.
Try using this in the foreach loop:
echo '<a id="seastags" href="/showRecipesFromTags.php?tagId=' .$tag11['Tag_id'] . '"><font size="' . rand(1,4) .'">' . $tag11['Tag_name'] . '</font> <br/></a> ';
Your choice are:
use a hidden field
put it in the URL
use a cookie