Please note: the site I'm working with doesn't allow the use of Javascript. It's a huge pain, but I can't do anything about it. I'm looking for (hopefully) a work around for my problem.
This is a bit of a weird situation, so I'm going to try and explain my problem as best as possible without getting too complicated.
I write style sheets and stuff for this site I go on called AniRoleplay, which is basically an cheap knock-off version of the old Myspace. I was making a custom bulletin, trying to move the comment section to another location on the page. To do that, I copy/pasted the form that the site uses by default to post comments.
That code is as follows:
<table align='center' class='txt_label'>
<tr>
<td width='100%'><p align='left'> <font face='Verdana' color='#000000' size='2'> <b>Add a Comment :</b> </font> </td>
</tr>
<tr>
<td width='100%'><p align='left'>
<textarea id='textarea1' name='comment_text' rows='5' cols='30' style='width:700; height:75'></textarea>
<br>
<br>
<b><font color='black'>Your image will display properly if this URL ends in .GIF, .PNG or .JPG. Anything else will not work.</font></b><br>
<input name='image' type='text' size='95' style='width:700px' placeholder='Image URL --- EXAMPLE: http://i.imgur.com/s7BBFmm.JPG'/>
</td>
</tr>
<tr> </tr>
<tr>
<td width='100%'><p align='left'>
<INPUT class=flat id=Submit onclick=document.theForm.details.value=idContent.document.body.innerHTML; type=submit value='Add Comment' name=Submit>
</td>
</tr>
</table>
However, when I added it and tested it.. I got this error from the site:
"You did not enter any text for your comment."
The result I'm looking for is something like this:
http://i.stack.imgur.com/1XaOg.jpg
I got that result by accident, but had no idea how I had gotten it. I ended up going back to an older version of the layout though because the submit button wasn't responding, but even when I did get it to respond, I kept constantly running into the "no text" error.
Last but not least, here's the link to the CodePen I have been working on for this layout: http://codepen.io/Peechiee/pen/qOBQZe?editors=110
I have seriously run out of ideas here. D: I don't know anything about PHP (I'm self taught and am pretty much only familiar with CSS and HTML) so I don't know if that is relevant to the situation but I'd really really appreciate some help.
Thanks in advance!
Related
I am trying to add a php code in my html file, but whenever i do, my file instead of outputting my expected outcome, it instead presents the source code
again, i am creating a server for my project at school and i am a total noob in programming as i learn it all by myself without formal education about it. i tried to save the file as both .html and .php, although .html presents the output, but not the desired one. now i have two files below and since i am a noob in programming, my concept was to have users input the form in the .html file and output in on an identical one but in .php
this is the first file, saved in ABM11.html
<form action="AMB11.php" method="post"><table border="0">
<tr>
<td>Name</td>
<td align="center"><input type="text" name="StudentName" size="30"></td>
</tr>
<tr>
<td>Subject</td>
<td align="center"><input type="text" name="Subject" size="30"></td>
</tr>
<tr>
<td>Final Grade</td>
<td align="center"><input type="text" name="FinalGrade" size="30"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="submit"></td>
</tr>
</table>
</form>
this is the second file, saved as ABM11.php
<?php
$studentname = $_POST['StudentName'];
$subject = $_POST['Subject'];
$finalgrade = $_POST['FinalGrade'];
echo $studentname '<\br>';
echo $subject '<\br>';
echo $finalgrade '<\br>';
?>
basically i just want users to answer a form then have that data be posted on the same page perpetually, not have my noob source code presented
it seems , the problem with your web server , weather you are using apache or nginx . its not running properly or its not configured properly on your local machine so rather then executing php code its just showing that file on the browser .
You can debug like , create one simple php file just like echo "yourname "; and put it to your www directory and try to run it form browser if the server is proper configured then it must print and if its not prited then its mistake with your local server configuration .
and also on your source code there is one mistake of echo and .
Wrong : echo $finalgrade '<\br>';
True : echo $finalgrade .'<\br>';
You must concat br with .
that is mistake 110% but as you said in your question the code is showing on the page is not only because of this , its surely configuration problem
if . is the only mistake then it wont show you the source code on the page but you will get any php error if thats the only issue .so check your config well first.
Thanks
Akshay Champavat
If you combine variables and strings in an echo, you need to add dots to connect them. So instead of this
echo $studentname '<br>';
you need to write it as
echo $studentname.'<br>';
And similar in all other lines.
(and no backslashes, by the way!)
And also ("sourcecode displayed...") make sure to open/call the php file via a server (for example XAMPP, via localhost), not simply as a file on your computer.
I have this html code(+some backdoor php codes) to delete images from my website, but the problem is that I need that browsing dialoge to be opened in a specific path and be stuck on that path, I like I don't want the user to be able to navigate through the folders as he likes, is that possible to be done in any ways?
<table>
<tr>
<td>Select a project : </td>
<td><input type='file' name='userFile'><br></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="upload_btn" value="delete"></td>
</tr>
</table>
thanks
No, it isn't … and it shows the user's local file system rather then the servers anyway.
Write some server side code to generate a list of files that could be deleted and generate an HTML document listing them instead.
I know this question is similar to other questions, I did hours of research yet I could not figure out a solution, please help me find a solution.
I want to pass textfield value from html to php textfield but instead of value, the php code is shown as output.
Page 1:
<body>
<form action="fare1.php" method="post">
<input name="address1" id="address1" type="text" size="15" value="City" />
<input name="" type="submit" />
</form>
</body>
Page 2:
<body>
<div class="content">
<h1>Instructions</h1>
<table width="200">
<tr>
<td colspan="2">
<input type="text" name="from" id="from" value="<?php echo $_POST['address1']; ?>" /></td>
</tr>
</table>
<!-- end .content --></div>
</body>
I tried using hidden fields, using javascript function and many other things but I couldn't reach a solution to my problem :(
Thanks!
Edit...
It seems I am having trouble with PHP itself, I am trying to figure it out now. PHP is not running in my system. Please let me know if you know of any free hosting sites which provides php support, I tried 50webs, it is saving the php files instead of opening it.
Thanks!
If the php is running on your server, fare1.php should execute without showing any php code for the output. If it is, then your server doesn't support the php. I suggest you download xampp. Its a free and open web server that supports php.
Hallo Friends,
I need a button with text on it in 2 lines. The length of the text is more than the space i have for it.:-) Image is not of my preference.
I have used the following code
<tr>
<td align="center">
<button type="submit" name="add_invoice" id="buttonstyle">
Add to Ready for<br />
Invoicing
</button>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" name="delete" value="Delete">
</td>
</tr>
This is working pretty good in IE 7.0.
But in IE 6.0 eventhough i click the second button delete, in $_POST, it is returning the values of both the buttons.
it has the value of [add_invoice] and [delete]. So i am not able to figure it out which one is clicked (in IE 6.0 Only).
Please help me to understand this behaviour. Let me know if you know any other alternative.
Thanks in advance!
The <button> element is buggy in IE. Try using an <input type="submit"> ?
EDIT: Since you need it to span 2 lines, I suggest styling the input submit or creating an image, unfortunately.
EDIT #2: You can also probably use <!--[if IE 6]> conditionals to feed an input type='image' to IE6 and button to other browsers if it really matters.
I do not know if this would work or not, but you could probably use a javascript onClick event to trigger the submit.
<tr>
<td align="center">
<button type="submit" onClick="document.formname.submit();" name="add_invoice" id="buttonstyle">
Add to Ready for<br />
Invoicing
</button>
</td>
</tr>
Remember to replace formname with the actual formname if this is to work, which I do not know if it will, as I do not have IE6 setup, I cannot test it.
UPDATE
I am not sure if this would be worth it or not, but you can set it up like this (or in a function) to have the value be changed.
<tr>
<td align="center">
<button type="submit" onClick="document.formname.delete.value = ''; document.formname.submit();" name="add_invoice" id="buttonstyle">
Add to Ready for<br />
Invoicing
</button>
</td>
Which should set the delete value to be empty. It is hackish and not sure if I would do it this way, but it is a way to achieve it. I would probably store that in a function, however, and just call the function. For demonstration / testing reasons, I did not do that for this example.
I got following scenario:
A site is sending a request to a php-file to hand me some data. For this request I am selecting an item - here is the code for that part:
<form action="?modul=transaktionen&subModul=monitor" method="post">
<input type="hidden" name="suchVal" value="1">
<input type="hidden" name="action" value="1">
<!-- A LOT OF STUFF INBETWEEN ... -->
<table>
<tr>
<td>
<input type="radio"
name="hostsARR[host][idGcomp]"
id="nod_331"
value="331">
</td>
<td>Some text which is really not important</td>
</tr>
<tr>
<td>
<input type="radio"
name="hostsARR[host][idGcomp]"
id="nod_332"
value="332">
</td>
<td>more text that is not important</td>
</tr>
</table>
<input type="submit" class="sendButton" name="edit" value="Show details">
</form>
And when I select one of these item and hit the button it should send me the request with these attributes:
action 1
edit Show details
hostsARR[host][idGcomp] 332
It does that normally, but when I add javascript to it it gets totally messed up! It does not send the right request. What happens is that I do not get the hostsARR. Everything else gets through. I added a script by frequency-decoder.com for pagination and for sorting. You can find the script here if you need a look at it: http://www.frequency-decoder.com/2007/10/19/client-side-table-pagination-script.
Basically my question is whether there are known Javascripts or bugs or whatever I don't know or am not capable of giving a name for that mess up POST (or other) requests?
Seriously this is driving me crazy as I really do not see a reason why sorting a table or rather adding javascript should alter a form element to that extent.
Thnx in advance for your help.
EDIT: The request doesn't work anywhere BUT IE ... dunno where IE is maybe more tolerant?
Answering to the information given, I can conclude that the pagination or sorting script has nothing to do with what causes your error.
My guess is that your manual actions have caused this or some other included script.
But unless you provide us these no-one can tell.
If you could provide the full source to recreate the problem we could all be of more help.