FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


A php problem





Billwaa
I have a little problem with my php script. (I am totally new to it, so I don't know what I did wrong. I follow the template.)

Here is the site

http://home.comcast.net//~billyhau/request.php


here is the script

request.php


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>Request</title>
</head>

<body>
<form action="request.php" method="post">
<p align="center" class="style1 style2"><u>Easy Graphic Request Generator</u></p>
<p>&nbsp;</p>
<p>Graphic type (sig, banners, loader, logo...):
<input type="text" name="type" />
</p>
<p>Size in pixel (width): <input type="text" name="width" /></p>
<p>Size in pixel (height): <input type="text" name="height" /></p>
<p>Background (transparent, solid red, wall, water...): <input type="text" name="background" /></p>
<p class="style2">--</p>
<p>Text line 1 (optional), size: <input type="text" name="text1" /></p>
<p>Text line 2 (optional), size: <input type="text" name="text2" /></p>
<p>Text line 3 (optional), size: <input type="text" name="text3" /></p>
<p class="style2">---</p>
<p>Graphics (optional): <input type="text" name="pic" /></p>
<p>Include &quot;http://&quot; </p>
<p>Graphic link 1 (optional): <input type="text" name="pic 2" /></p>
<p>Graphic link 2 (optional): <input type="text" name="pic3" /></p>
<p>Graphic link 3 (optional): <input type="text" name="pic4" /></p>
<p class="style2">----</p>
<p>Other: <input type="text" name="other" /></p>
<p>File Format (gif, png, jepg, jpg, bmp...): <input type="text" name="format" /></p>
<p><input type="submit" /></p>
</form>
<p>&nbsp;</p>
</body>
</html>


here is the script for action.php


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>Action</title>
</head>

<body>
<p>Please copy the below and paste in the topic you request in.</p>
<p>&nbsp;</p>
<p>Graphic Request Type: <?php echo $_POST['type']; ?>.</p>
<p>Width [pixel]: <?php echo $_POST['width']; ?>.</p>
<p>Height [pixel]: <?php echo $_POST['height']; ?>.</p>
<p>Background: <?php echo $_POST['background']; ?>.</p>
<p>--</p>
<p>Text line 1, size: <?php echo $_POST['text1']; ?>.</p>
<p>Text line 2, size: <?php echo $_POST['text2']; ?>.</p>
<p>Text line 3, size: <?php echo $_POST['text3']; ?>.</p>
<p>---</p>
<p>Graphics: <?php echo $_POST['pic']; ?>.</p>
<p>Graphic link 1: [img]<?php echo $_POST['pic2']; ?>[/img].</p>
<p>Graphic link 2: [img]<?php echo $_POST['pic3']; ?>[/img].</p>
<p>Graphic link 3: [img]<?php echo $_POST['pic4']; ?>[/img].</p>
<p>----</p>
<p>Other: <?php echo $_POST['other']; ?>.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Please copy the above and paste in the topic you request in.</p>
</body>
</html>



thanks
thnn
Is php enabled or installed on your webhost. That could be a reason why it is the page is being shown as plain text.

Otherwise you may need to associated .php with the PHP Phaser.
Naif
Look at this line from request.php:

Code:

<form action="request.php" method="post">


The name of the php file which processes the submited data is action.php where as you supplied request.php as the file. So that line should be changed to

Code:

<form action="action.php" method="post">
sonam
You are pointed your request.php on request.php! Change in request.php action command on action.php and I hope so it will work. BTW I think it is much better to use different names for your php scripts then action, form, request, etc. for easier remembering. E.g. graphicgen.php.


<form action="action.php" method="post">

Sonam
JustaMin
Just a quick tip, you can use:

Code:
<?=$_POST['text1']?>


Instead of the long way you are using:

Code:
<?php echo $_POST['text1']; ?>


Saves a few bytes anyway!
Billwaa
thanks, I change the things, but still not working somehow.

The page show up as code in FireFox browser, but in Internet Explorer, it turn out fine. However, when I press submit in internet explorer, it go to action.php showing to the page cannot be display thing. Then when I press enter on the address bar again it show the page it supose to show but without the information I put in earlier. Shocked

Is there anyway to fix that?
JustaMin
This is working fine on my test server, try pressing Shift+F5 in your browsers to make sure you are using the updated version of the code. Here's whats working for me:

Request.php:

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<title>Request</title>
</head>
<body>
<form action="action.php" method="post">
  <p align="center" class="style1 style2"><u>Easy Graphic Request Generator</u></p>
  <p>&nbsp;</p>
  <p>Graphic type (sig, banners, loader, logo...):
    <input type="text" name="type" />
  </p>
  <p>Size in pixel (width):
    <input type="text" name="width" />
  </p>
  <p>Size in pixel (height):
    <input type="text" name="height" />
  </p>
  <p>Background (transparent, solid red, wall, water...):
    <input type="text" name="background" />
  </p>
  <p class="style2">--</p>
  <p>Text line 1 (optional), size:
    <input type="text" name="text1" />
  </p>
  <p>Text line 2 (optional), size:
    <input type="text" name="text2" />
  </p>
  <p>Text line 3 (optional), size:
    <input type="text" name="text3" />
  </p>
  <p class="style2">---</p>
  <p>Graphics (optional):
    <input type="text" name="pic" />
  </p>
  <p>Include &quot;http://&quot; </p>
  <p>Graphic link 1 (optional):
    <input type="text" name="pic 2" />
  </p>
  <p>Graphic link 2 (optional):
    <input type="text" name="pic3" />
  </p>
  <p>Graphic link 3 (optional):
    <input type="text" name="pic4" />
  </p>
  <p class="style2">----</p>
  <p>Other:
    <input type="text" name="other" />
  </p>
  <p>File Format (gif, png, jepg, jpg, bmp...):
    <input type="text" name="format" />
  </p>
  <p>
    <input type="submit" />
  </p>
</form>
<p>&nbsp;</p>
</body>
</html>


Action.php:

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>Action</title>
</head>

<body>
<p>Please copy the below and paste in the topic you request in.</p>
<p>&nbsp;</p>
<p>Graphic Request Type: <?php echo $_POST['type']; ?>.</p>
<p>Width [pixel]: <?php echo $_POST['width']; ?>.</p>
<p>Height [pixel]: <?php echo $_POST['height']; ?>.</p>
<p>Background: <?php echo $_POST['background']; ?>.</p>
<p>--</p>
<p>Text line 1, size: <?php echo $_POST['text1']; ?>.</p>
<p>Text line 2, size: <?php echo $_POST['text2']; ?>.</p>
<p>Text line 3, size: <?php echo $_POST['text3']; ?>.</p>
<p>---</p>
<p>Graphics: <?php echo $_POST['pic']; ?>.</p>
<p>Graphic link 1: [img]<?php echo $_POST['pic2']; ?>[/img].</p>
<p>Graphic link 2: [img]<?php echo $_POST['pic3']; ?>[/img].</p>
<p>Graphic link 3: [img]<?php echo $_POST['pic4']; ?>[/img].</p>
<p>----</p>
<p>Other: <?php echo $_POST['other']; ?>.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Please copy the above and paste in the topic you request in.</p>
</body>
</html>
Billwaa
I upload the new script and it still don't work...
JustaMin
Must be something to do with your browser cos it worked fine for me. Did you make sure you refreshed the page after uploading?
mathiaus
I'm getting the same problem thought the code on frihost works. I'm with thnn on ths one and saying your server sucks. Try contacting their support!
http://www.comcast.net/help/contact/
thnn
It is possible that your webhost is not allowing forms to post to a script. This would explain the HTTP 405 - Resource not allowed error that is coming up. It now depends on what server software your webhost is using. If you are able to use .htaccess files and you are on apache you should be able to force Apache to allow the Post method.

Why dont you try applying for hosting here at frihost. Its excellent. Very Happy
Billwaa
yeah, I guess I should
Related topics
simple php problem, please help...
A PHP problem !
HTML + PHP problem
PHP problem...
PHP Problem: Unable to execute ext. commands
PHP Problem
PHP Problem...
PHP Problem
[PHP] Problem with Dynamic Sig's Font Color
Form and PHP problem
PHP imagecreate + CSS problem.
PHP imagecreate + CSS problem.
Could there be a PhP problem on the server?
[help]Mysql & php problem
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.