Board index   FAQ   Search  
Register  Login
Board index PHP PHP Installation

Cookies

Forum for you who has PHP installation issues

Moderators: macek, egami, gesf

Cookies

Postby redhead » Mon Mar 08, 2004 10:26 am

Hi There

I have several scripts that work amazing with my ISP

I have then installed Apache 1.3.29, MySQL, PHP 4, phpMyAdmin

So then i tryed to run the files on my local mahcine. Had problems with session. added a dir called sessiondata and added the path to that dir in my php.ini file under session path..

But i'm know finding some very simple scirpts such as

Code: Select all
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form action="brownies.php" method="get">

<input name="item" type="hidden" value="Bag of Fudgy Two-Bite Brownies"><input name="price" type="hidden" value="2.99">

  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td><img src="images/special1-1.jpg" width="300" height="50" onClick="printText('Add a bag of fudg two-bite brownies to any order!');"></td>
     </tr>
     <tr>
      <td><textarea  name="order" cols="30" rows="9" wrap="VIRTUAL"></textarea></td></tr>
    </tr>
    <tr>
      <td> <input type="image" src="images/order.jpg" width="200" name-"submit" height="50" /></td>
    </tr>
  </table>
</form>
</body>
</html>


calles this file:
Code: Select all
<?php
include ("dbconnect.php");

   $sql = "INSERT INTO ordertemp (item,price) VALUES ('$item','$price')";
   // do the query...
$results = mysql_query($sql, $db);

   header("location: ./specials.php");
?>


Will add a blank line in my database with out adding the filds?? any suggestions..

Even using code such as:
Code: Select all
<?php

include ("dbconnect.php");

$sql = "DELETE FROM ordertemp WHERE id = '$id'";
$result = mysql_query($sql, $db);

header("location: ./specials.php");
?>


Is a problem, but if i use sessions i'm able to add?? :shock:
redhead
New php-forum User
New php-forum User
 
Posts: 14
Joined: Thu Mar 04, 2004 11:20 am

Postby redhead » Mon Mar 08, 2004 12:02 pm

Just incase anyone else is having the same problem check out

http://ca2.php.net/variables.predefined

:-D
redhead
New php-forum User
New php-forum User
 
Posts: 14
Joined: Thu Mar 04, 2004 11:20 am

Postby gesf » Mon Mar 08, 2004 1:00 pm

Try to get your variables in the second age with:
Code: Select all
$_GET['whatever'];
$HTTP_GET_VARS['whatever'];

But are you using sessions or not !?

Yeh, even using sessions you´ll be able to add it!!
For security reasons, i suggest you to make a simple verification before using the sql query´s, like:
[php]<?
if($submit){
// Do something
}
else{
// Do another thing
}
?>[/php]

BTW, you have an error here:
Code: Select all
<input type="image" src="images/order.jpg" width="200" name-"submit" height="50" /></td>

name-"submit", should be: name="submit" !
Last edited by gesf on Mon Mar 08, 2004 1:07 pm, edited 2 times in total.
User avatar
gesf
Moderator
Moderator
 
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden

Postby redhead » Mon Mar 08, 2004 1:03 pm

Got that error that's :-D

Thanks So much for your sugestions.. I'm going to put them into effect asap.. :D
redhead
New php-forum User
New php-forum User
 
Posts: 14
Joined: Thu Mar 04, 2004 11:20 am


Return to PHP Installation

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron